Class: Workout

Inherits:
Object
  • Object
show all
Defined in:
lib/swole-news/workout.rb

Constant Summary collapse

@@all =
[]

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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

#articleObject

Returns the value of attribute article.



2
3
4
# File 'lib/swole-news/workout.rb', line 2

def article
  @article
end

#definitionObject

Returns the value of attribute definition.



2
3
4
# File 'lib/swole-news/workout.rb', line 2

def definition
  @definition
end

#titleObject

Returns the value of attribute title.



2
3
4
# File 'lib/swole-news/workout.rb', line 2

def title
  @title
end

Class Method Details

.allObject



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