class Category
Attributes
hotels[RW]
name[RW]
url[RW]
Public Class Methods
all()
click to toggle source
# File lib/best_boutique_hotels/category.rb, line 28 def self.all @@all end
create_from_collection(categories_array)
click to toggle source
# File lib/best_boutique_hotels/category.rb, line 22 def self.create_from_collection(categories_array) categories_array.each_with_index do |category| self.all << Category.new(category[:category_name], category[:category_url]) end end
new(name, url)
click to toggle source
# File lib/best_boutique_hotels/category.rb, line 7 def initialize(name, url) @name = name @url = url @hotels = [] end
Public Instance Methods
add_hotels(hotels_array)
click to toggle source
# File lib/best_boutique_hotels/category.rb, line 13 def add_hotels(hotels_array) hotels_array.each do |hotel| unless @hotels.include?(hotel) @hotels << hotel hotel.category = self end end end