class Hotel

Attributes

city[RW]
hotel_booking[RW]
hotel_describe[RW]
hotel_name[RW]
hotel_rating[RW]

Public Class Methods

all() click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 21
def self.all
 @@all
end
clear_all() click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 15
def self.clear_all
 @@all.clear
end
find(id) click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 18
def  self.find(id)
  @@all[id]
end
find_by_city_name(city) click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 35
def self.find_by_city_name(city)
  @@all.select{|h| h.city.name == city || h.city.name == "Baghdād"}.map{|h| h.hotel_name}
end
hotel_info(id) click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 25
def self.hotel_info(id)
  hotel=self.find(id)
  puts ""
  puts "+-------------------------------------------------------------------------+".red
  puts "  #{hotel.hotel_name}\t".blue + "#{hotel.hotel_rating}\t".yellow + "#{hotel.hotel_booking}".green
  puts "  #{hotel.hotel_describe}"
  puts "+-------------------------------------------------------------------------+".red
  puts ""
end
new(hotel_name,city,hotel_rating,hotel_describe,hotel_booking) click to toggle source
# File lib/hotels_in_iraq/hotel.rb, line 5
 def initialize(hotel_name,city,hotel_rating,hotel_describe,hotel_booking)
  @hotel_name=hotel_name
  @hotel_rating=hotel_rating
  @hotel_describe=hotel_describe
  @hotel_booking=hotel_booking
  self.city=city
  city.hotels << self
   @@all << self
end