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.



68
69
70
# File 'app/models/maglev/section.rb', line 68

def initialize(array)
  @array = array
end

Instance Attribute Details

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



76
77
78
# File 'app/models/maglev/section.rb', line 76

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