Class: PhlexUI::AttributeMerger

Inherits:
Object
  • Object
show all
Defined in:
lib/phlex_ui/attribute_merger.rb

Constant Summary collapse

OVERRIDE_KEY =
"!".freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

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_attrsObject (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_attrsObject (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

#callObject



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