Module: Dommy::Internal::ReflectedAttributes::ClassMethods

Defined in:
lib/dommy/internal/reflected_attributes.rb

Instance Method Summary collapse

Instance Method Details

#reflect_boolean(*names, **mapped) ⇒ Object



47
48
49
# File 'lib/dommy/internal/reflected_attributes.rb', line 47

def reflect_boolean(*names, **mapped)
  _reflect(:boolean, names, mapped)
end

#reflect_string(*names, **mapped) ⇒ Object



43
44
45
# File 'lib/dommy/internal/reflected_attributes.rb', line 43

def reflect_string(*names, **mapped)
  _reflect(:string, names, mapped)
end

#reflected_property_mapObject

Merged ‘js_key => ruby_name` map across the class ancestry (memoized). Recomputed lazily; `_reflect` invalidates the cache when called.



53
54
55
56
57
58
# File 'lib/dommy/internal/reflected_attributes.rb', line 53

def reflected_property_map
  @__reflected_map__ ||= begin
    inherited = superclass.respond_to?(:reflected_property_map) ? superclass.reflected_property_map : {}
    inherited.merge(@__reflected_props__ || {})
  end
end