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.
68 69 70 |
# File 'app/models/maglev/section.rb', line 68 def initialize(array) @array = array end |
Instance Attribute Details
#array ⇒ Object (readonly)
Returns the value of attribute array.
66 67 68 |
# File 'app/models/maglev/section.rb', line 66 def array @array end |
Instance Method Details
#as_json(**_options) ⇒ Object
80 81 82 |
# File 'app/models/maglev/section.rb', line 80 def as_json(**) @array.as_json end |
#find(id) ⇒ Object
72 73 74 |
# File 'app/models/maglev/section.rb', line 72 def find(id) @array.find { |section| section.id == id } end |
#grouped_by_category ⇒ Object
76 77 78 |
# File 'app/models/maglev/section.rb', line 76 def grouped_by_category @array.group_by(&:category) end |