Class: Searchables
- Inherits:
-
Object
- Object
- Searchables
- Defined in:
- lib/classes/searchables.rb
Instance Attribute Summary collapse
-
#raw ⇒ Object
Returns the value of attribute raw.
Instance Method Summary collapse
- #all ⇒ Object
- #duration(name) ⇒ Object
-
#initialize(hash) ⇒ Searchables
constructor
A new instance of Searchables.
Constructor Details
#initialize(hash) ⇒ Searchables
5 6 7 8 |
# File 'lib/classes/searchables.rb', line 5 def initialize(hash) @raw = hash @all = {} end |
Instance Attribute Details
#raw ⇒ Object
Returns the value of attribute raw.
3 4 5 |
# File 'lib/classes/searchables.rb', line 3 def raw @raw end |
Instance Method Details
#all ⇒ Object
14 15 16 17 18 19 20 21 22 23 |
# File 'lib/classes/searchables.rb', line 14 def all if @all.empty? @raw.keys.each do |name| @all.merge!(name => Searchable.new({raw_name: name, duration: duration(name)})) end @all else @all end end |
#duration(name) ⇒ Object
10 11 12 |
# File 'lib/classes/searchables.rb', line 10 def duration(name) @raw[name] end |