Class: Maglev::Theme::SectionCategory
- Inherits:
-
Object
- Object
- Maglev::Theme::SectionCategory
- Includes:
- ActiveModel::Model
- Defined in:
- app/models/maglev/theme/section_category.rb
Overview
rubocop:disable Style/ClassAndModuleChildren
Instance Attribute Summary collapse
-
#id ⇒ Object
attributes ##.
-
#name ⇒ Object
attributes ##.
Class Method Summary collapse
-
.build(hash) ⇒ Object
class methods ##.
- .build_many(list) ⇒ Object
Instance Attribute Details
#id ⇒ Object
attributes ##
9 10 11 |
# File 'app/models/maglev/theme/section_category.rb', line 9 def id @id end |
#name ⇒ Object
attributes ##
9 10 11 |
# File 'app/models/maglev/theme/section_category.rb', line 9 def name @name end |
Class Method Details
.build(hash) ⇒ Object
class methods ##
13 14 15 16 17 |
# File 'app/models/maglev/theme/section_category.rb', line 13 def self.build(hash) attributes = hash.slice('name', 'id') attributes['id'] ||= attributes['name'].parameterize(separator: '_') new(attributes) end |
.build_many(list) ⇒ Object
19 20 21 |
# File 'app/models/maglev/theme/section_category.rb', line 19 def self.build_many(list) (list || []).map { |hash| build(hash) } end |