-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jocelyn Gonzalez -- Carets #27
base: master
Are you sure you want to change the base?
Conversation
HotelWhat We're Looking For
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some in-code comments
lib/assign_room.rb
Outdated
require "pry" | ||
|
||
module Hotel | ||
class AssignRoom |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure what purpose this method really serves. A date range and a room #, would be part of a reservation, but why make a class of the two with no business logic?
It seems to act as a Reservation. That would make a better name.
lib/reservation.rb
Outdated
|
||
module Hotel | ||
class Reservation | ||
DATE = /^[0-9]{1,2}-[0-9]{1,2}-[0-9]{4}$/ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great that you're using a Regex!
lib/reservation.rb
Outdated
#strptime could be added all at once here instead? | ||
# used for adding array in reserve_room | ||
# will use for checking availability in available_room | ||
def date_range(check_in, check_out) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Your Reservation
class seems like it acts as a collection of reservations, and wouldn't Hotel
make a better name for this class.
lib/reservation.rb
Outdated
end | ||
@rooms.each do |room| | ||
unless res_nums.include? room.num | ||
return room #returns first instance |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
lib/reservation.rb
Outdated
end | ||
|
||
def total | ||
return "$#{(stay_array.length-1) * 200}.00" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This returns the total for all reservations, rather than for a particular reservation.
Hotel
Congratulations! You're submitting your assignment!
Comprehension Questions