class TouristGuide::Tour

Attributes

address[RW]
description[RW]
name[RW]

Public Class Methods

all() click to toggle source
# File lib/tourist_guide/tour.rb, line 22
def self.all
  @@all
end
clear() click to toggle source

to delete duplicated & previous lists

# File lib/tourist_guide/tour.rb, line 33
def self.clear
 @@all =[]
end
create_from_collection(array) click to toggle source
# File lib/tourist_guide/tour.rb, line 26
def self.create_from_collection(array)
  array.each do |hash|
    self.new(hash)
  end
end
new(attr_hash) click to toggle source
# File lib/tourist_guide/tour.rb, line 5
def initialize(attr_hash)
  # attr_hash.each do |attribute, v|
  # self.name= attribute(:name)
  # self.address= attribute(:address)
  # self.description= attribute(:description)

  # self.send "name=", "John Smith"
  # equivalent to
  # self.name = "John Smith"

  attr_hash.each do |attribute, v|
    self.send("#{attribute}=",v)

  end
  @@all << self
end