Class: Metadata::BuilderBase

Inherits:
ActionView::Helpers::FormBuilder
  • Object
show all
Defined in:
app/models/metadata/builder_base.rb

Direct Known Subclasses

FormBuilder, ViewBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args) ⇒ BuilderBase

Returns a new instance of BuilderBase.



5
6
7
8
# File 'app/models/metadata/builder_base.rb', line 5

def initialize(*args, &)
  super
  @views, @locals, @root = {}, {}, nil
end

Instance Attribute Details

#locals=(value) ⇒ Object (writeonly)

Sets the attribute locals

Parameters:

  • value

    the value to set the attribute locals to.



3
4
5
# File 'app/models/metadata/builder_base.rb', line 3

def locals=(value)
  @locals = value
end

Instance Method Details

#view_for(type, partial_name = nil) ⇒ Object



10
11
12
# File 'app/models/metadata/builder_base.rb', line 10

def view_for(type, partial_name = nil, &)
  @views[type.to_sym] = partial_name.nil? ? { inline: capture(&) } : { partial: partial_name }
end