module GenericViewMapper::SchemaDefinition::DSL

Public Instance Methods

attribute(name, options = {}) click to toggle source
# File lib/generic_view_mapper/view/schema_definition.rb, line 16
def attribute(name, options = {})
  attributes << Attribute.new(name, options)
end
attributes() click to toggle source
# File lib/generic_view_mapper/view/schema_definition.rb, line 4
def attributes
  @attributes ||= if is_a?(Class) && superclass.respond_to?(:attributes)
                    superclass.attributes.clone
                  else
                    []
                  end
end
attributes=(value) click to toggle source
# File lib/generic_view_mapper/view/schema_definition.rb, line 12
def attributes=(value)
  @attributes = value
end
section(name, &block) click to toggle source
# File lib/generic_view_mapper/view/schema_definition.rb, line 20
def section(name, &block)
  section = Section.new(name)

  if (old_section = attributes.find { |x| x.name == name })
    attributes.delete(old_section)
    section.attributes += old_section.attributes
  end

  section.instance_eval(&block)
  attributes << section
end