Class: Libri::Quote
- Inherits:
-
Object
- Object
- Libri::Quote
- Defined in:
- lib/libri/quote.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#quote ⇒ Object
Returns the value of attribute quote.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(quote_hash) ⇒ Quote
constructor
A new instance of Quote.
Constructor Details
#initialize(quote_hash) ⇒ Quote
Returns a new instance of Quote.
6 7 8 9 10 11 |
# File 'lib/libri/quote.rb', line 6 def initialize(quote_hash) quote_hash.map { |key, val| send "#{key}=", val } @@all << self end |
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author.
2 3 4 |
# File 'lib/libri/quote.rb', line 2 def @author end |
#quote ⇒ Object
Returns the value of attribute quote.
2 3 4 |
# File 'lib/libri/quote.rb', line 2 def quote @quote end |
Class Method Details
.all ⇒ Object
19 20 21 |
# File 'lib/libri/quote.rb', line 19 def self.all @@all end |
.create_from_collection(quotes_array) ⇒ Object
13 14 15 16 17 |
# File 'lib/libri/quote.rb', line 13 def self.create_from_collection(quotes_array) quotes_array.map { |quote_hash| self.new(quote_hash) } end |