Class: BeerList::List
- Inherits:
-
Array
- Object
- Array
- BeerList::List
- Defined in:
- lib/beer_list/list.rb
Instance Attribute Summary collapse
-
#establishment ⇒ Object
readonly
Returns the value of attribute establishment.
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ List
constructor
A new instance of List.
- #old_to_json ⇒ Object
- #to_hash ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(opts = {}) ⇒ List
Returns a new instance of List.
5 6 7 8 9 |
# File 'lib/beer_list/list.rb', line 5 def initialize(opts={}) ary = opts[:array] || [] @establishment = opts[:establishment] super ary.sort end |
Instance Attribute Details
#establishment ⇒ Object (readonly)
Returns the value of attribute establishment.
3 4 5 |
# File 'lib/beer_list/list.rb', line 3 def establishment @establishment end |
Instance Method Details
#old_to_json ⇒ Object
15 |
# File 'lib/beer_list/list.rb', line 15 alias :old_to_json :to_json |
#to_hash ⇒ Object
11 12 13 |
# File 'lib/beer_list/list.rb', line 11 def to_hash Hash[establishment, self.to_a] end |
#to_json ⇒ Object
17 18 19 |
# File 'lib/beer_list/list.rb', line 17 def to_json to_hash.to_json end |