Class: Workout
- Inherits:
-
Object
- Object
- Workout
- Defined in:
- lib/swole-news/workout.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#article ⇒ Object
Returns the value of attribute article.
-
#definition ⇒ Object
Returns the value of attribute definition.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(workout_hash) ⇒ Workout
constructor
A new instance of Workout.
Constructor Details
#initialize(workout_hash) ⇒ Workout
Returns a new instance of Workout.
6 7 8 9 |
# File 'lib/swole-news/workout.rb', line 6 def initialize(workout_hash) workout_hash.each {|k,v| self.send("#{k}=",v)} @@all << self end |
Instance Attribute Details
#article ⇒ Object
Returns the value of attribute article.
2 3 4 |
# File 'lib/swole-news/workout.rb', line 2 def article @article end |
#definition ⇒ Object
Returns the value of attribute definition.
2 3 4 |
# File 'lib/swole-news/workout.rb', line 2 def definition @definition end |
#title ⇒ Object
Returns the value of attribute title.
2 3 4 |
# File 'lib/swole-news/workout.rb', line 2 def title @title end |
Class Method Details
.all ⇒ Object
15 16 17 |
# File 'lib/swole-news/workout.rb', line 15 def self.all @@all end |
.create_from_collection(workout_array) ⇒ Object
11 12 13 |
# File 'lib/swole-news/workout.rb', line 11 def self.create_from_collection(workout_array) workout_array.map {|workout_hash| self.new(workout_hash)} end |