Class: PhlexUI::AttributeMerger
- Inherits:
-
Object
- Object
- PhlexUI::AttributeMerger
- Defined in:
- lib/phlex_ui/attribute_merger.rb
Constant Summary collapse
- OVERRIDE_KEY =
"!".freeze
Instance Attribute Summary collapse
-
#default_attrs ⇒ Object
readonly
Returns the value of attribute default_attrs.
-
#user_attrs ⇒ Object
readonly
Returns the value of attribute user_attrs.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(default_attrs, user_attrs) ⇒ AttributeMerger
constructor
A new instance of AttributeMerger.
Constructor Details
#initialize(default_attrs, user_attrs) ⇒ AttributeMerger
Returns a new instance of AttributeMerger.
6 7 8 9 |
# File 'lib/phlex_ui/attribute_merger.rb', line 6 def initialize(default_attrs, user_attrs) @default_attrs = flatten_hash(default_attrs) @user_attrs = flatten_hash(user_attrs) end |
Instance Attribute Details
#default_attrs ⇒ Object (readonly)
Returns the value of attribute default_attrs.
3 4 5 |
# File 'lib/phlex_ui/attribute_merger.rb', line 3 def default_attrs @default_attrs end |
#user_attrs ⇒ Object (readonly)
Returns the value of attribute user_attrs.
3 4 5 |
# File 'lib/phlex_ui/attribute_merger.rb', line 3 def user_attrs @user_attrs end |
Instance Method Details
#call ⇒ Object
11 12 13 14 |
# File 'lib/phlex_ui/attribute_merger.rb', line 11 def call merged_attrs = merge_hashes(default_attrs, non_override_attrs) mix(merged_attrs, override_attrs) end |