Class: ActionBlocks::FormSectionBuilder

Inherits:
BaseBuilder show all
Defined in:
lib/action_blocks/builders/form_builder.rb

Overview

Section

Instance Attribute Summary collapse

Attributes inherited from BaseBuilder

#dsl_delegate, #id

Instance Method Summary collapse

Methods inherited from BaseBuilder

#after_build, #after_load, array_fields, block_type, builds, builds_many, delegate_class, #evaluate, #freeze, includes_scheme_helpers, #initialize, #is_block?, #key, references, sets, sets_many, #ui_reference, #valid?

Constructor Details

This class inherits a constructor from ActionBlocks::BaseBuilder

Instance Attribute Details

#formObject

Returns the value of attribute form.



61
62
63
# File 'lib/action_blocks/builders/form_builder.rb', line 61

def form
  @form
end

Instance Method Details

#before_build(parent, *args) ⇒ Object



66
67
68
69
70
71
# File 'lib/action_blocks/builders/form_builder.rb', line 66

def before_build(parent, *args)
  @form = parent
  @title = args[0].to_s.titleize
  @width = 4
  @label = @field.to_s.titleize
end

#hashify(user) ⇒ Object



73
74
75
76
77
78
79
# File 'lib/action_blocks/builders/form_builder.rb', line 73

def hashify(user)
  {
    title: @title,
    width: @width,
    fields: @fields.map {|f| f.hashify(user)},
  }
end