module Prismatic::ElementContainer
Private Instance Methods
attribute_for(type)
click to toggle source
# File lib/prismatic/element_container.rb, line 29 def attribute_for(type) "data-#{Prismatic.prefix}-#{type}" end
find_matches(type)
click to toggle source
# File lib/prismatic/element_container.rb, line 11 def find_matches(type) attribute = attribute_for(type) find_all("[#{attribute}]").each do |el| name = el[attribute] next if has_instance_method?(self.class, name) if is_section?(type) self.class.send type.intern, name, Prismatic::Section, "[#{attribute}=\"#{name}\"]" else self.class.send type.intern, name, "[#{attribute}=\"#{name}\"]" end end end
has_instance_method?(klass, method)
click to toggle source
# File lib/prismatic/element_container.rb, line 33 def has_instance_method?(klass, method) klass.instance_methods.include?(method.intern) end
is_section?(type)
click to toggle source
# File lib/prismatic/element_container.rb, line 25 def is_section?(type) type.start_with?('section') end
update_elements()
click to toggle source
# File lib/prismatic/element_container.rb, line 4 def update_elements find_matches 'element' find_matches 'elements' find_matches 'section' find_matches 'sections' end