class GenericViewMapper::Section

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/generic_view_mapper/view/section.rb, line 8
def initialize(name)
  @name = name
end

Public Instance Methods

field_name() click to toggle source
# File lib/generic_view_mapper/view/section.rb, line 12
def field_name
  name
    .to_s
    .camelize(:lower)
    .to_sym
end
render(target, view_context) click to toggle source
# File lib/generic_view_mapper/view/section.rb, line 19
def render(target, view_context)
  {
    field_name => attributes.inject({}) do |accum, el|
      accum.merge(el.render(target, view_context))
    end
  }
end