class NationalParks::Park

Attributes

description[RW]
location[RW]
more_info_url[RW]
name[RW]
state[R]
type[RW]

Public Class Methods

new(park_attribute_hash = nil) click to toggle source
# File lib/national_parks/park.rb, line 6
def initialize(park_attribute_hash = nil)
  if park_attribute_hash
    park_attribute_hash.each{|key, value| self.send("#{key}=", value)}
  end
end

Public Instance Methods

state=(state) click to toggle source
# File lib/national_parks/park.rb, line 12
def state=(state) # belongs to state object interface
  if !state.is_a?(NationalParks::State)
    raise InvalidType, "#{state.class} received, State expected"
  else
    @state = state
    state.add_park(self) unless state.parks.include?(self)
  end
end