Class: Maglev::Section::Store
- Inherits:
-
Object
- Object
- Maglev::Section::Store
- Extended by:
- Forwardable
- Defined in:
- app/models/maglev/section.rb
Instance Attribute Summary collapse
-
#array ⇒ Object
readonly
Returns the value of attribute array.
Instance Method Summary collapse
- #as_json(**_options) ⇒ Object
- #find(id) ⇒ Object
- #grouped_by_category ⇒ Object
-
#initialize(array) ⇒ Store
constructor
A new instance of Store.
Constructor Details
#initialize(array) ⇒ Store
Returns a new instance of Store.
77 78 79 |
# File 'app/models/maglev/section.rb', line 77 def initialize(array) @array = array end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
75 76 77 |
# File 'app/models/maglev/section.rb', line 75 def array @array end |
Instance Method Details
#as_json(**_options) ⇒ Object
89 90 91 |
# File 'app/models/maglev/section.rb', line 89 def as_json(**) @array.as_json end |
#find(id) ⇒ Object
81 82 83 |
# File 'app/models/maglev/section.rb', line 81 def find(id) @array.find { |section| section.id == id } end |
#grouped_by_category ⇒ Object
85 86 87 |
# File 'app/models/maglev/section.rb', line 85 def grouped_by_category @array.group_by(&:category) end |