Class: Maglev::Content::SettingContent::AssociationProxy
- Inherits:
-
Object
- Object
- Maglev::Content::SettingContent::AssociationProxy
- Includes:
- Enumerable
- Defined in:
- app/models/maglev/content/setting_content.rb
Instance Attribute Summary collapse
-
#settings ⇒ Object
readonly
Returns the value of attribute settings.
Instance Method Summary collapse
- #[](id) ⇒ Object
- #each(&block) ⇒ Object
-
#initialize(raw_settings) ⇒ AssociationProxy
constructor
A new instance of AssociationProxy.
- #value_of(id) ⇒ Object
Constructor Details
#initialize(raw_settings) ⇒ AssociationProxy
Returns a new instance of AssociationProxy.
15 16 17 |
# File 'app/models/maglev/content/setting_content.rb', line 15 def initialize(raw_settings) @settings = raw_settings.map { |raw_setting| Maglev::Content::SettingContent.new(raw_setting) } end |
Instance Attribute Details
#settings ⇒ Object (readonly)
Returns the value of attribute settings.
13 14 15 |
# File 'app/models/maglev/content/setting_content.rb', line 13 def settings @settings end |
Instance Method Details
#[](id) ⇒ Object
19 20 21 |
# File 'app/models/maglev/content/setting_content.rb', line 19 def [](id) settings.find { |s| s.id == id } end |
#each(&block) ⇒ Object
27 28 29 |
# File 'app/models/maglev/content/setting_content.rb', line 27 def each(&block) settings.each(&block) end |
#value_of(id) ⇒ Object
23 24 25 |
# File 'app/models/maglev/content/setting_content.rb', line 23 def value_of(id) self[id]&.value end |