Class: Maglev::Section::Store

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
app/models/maglev/section.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#arrayObject (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(**_options)
  @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_categoryObject



85
86
87
# File 'app/models/maglev/section.rb', line 85

def grouped_by_category
  @array.group_by(&:category)
end