Class: TrailInfo::Trail
- Inherits:
-
Object
- Object
- TrailInfo::Trail
- Defined in:
- lib/trail_info/trail.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#length ⇒ Object
Returns the value of attribute length.
-
#name ⇒ Object
Returns the value of attribute name.
-
#state ⇒ Object
Returns the value of attribute state.
-
#surface ⇒ Object
Returns the value of attribute surface.
-
#synopsis ⇒ Object
Returns the value of attribute synopsis.
-
#url ⇒ Object
Returns the value of attribute url.
Class Method Summary collapse
-
.all ⇒ Object
returns all trail instances.
Instance Method Summary collapse
-
#initialize(state, trail_attributes) ⇒ Trail
constructor
Creates new trail instance.
-
#save ⇒ Object
saves trail instance.
Constructor Details
#initialize(state, trail_attributes) ⇒ Trail
Creates new trail instance
7 8 9 10 11 12 |
# File 'lib/trail_info/trail.rb', line 7 def initialize(state, trail_attributes) #Creates new trail instance trail_attributes.each do |attribute_name, attribute_value| self.send("#{attribute_name}=", attribute_value) end save end |
Instance Attribute Details
#length ⇒ Object
Returns the value of attribute length.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def length @length end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def name @name end |
#state ⇒ Object
Returns the value of attribute state.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def state @state end |
#surface ⇒ Object
Returns the value of attribute surface.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def surface @surface end |
#synopsis ⇒ Object
Returns the value of attribute synopsis.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def synopsis @synopsis end |
#url ⇒ Object
Returns the value of attribute url.
3 4 5 |
# File 'lib/trail_info/trail.rb', line 3 def url @url end |
Class Method Details
.all ⇒ Object
returns all trail instances
18 19 20 |
# File 'lib/trail_info/trail.rb', line 18 def self.all #returns all trail instances @@all end |
Instance Method Details
#save ⇒ Object
saves trail instance
14 15 16 |
# File 'lib/trail_info/trail.rb', line 14 def save #saves trail instance @@all << self end |