Class: Metadata::BuilderBase

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

Overview

rubocop:todo Style/Documentation

Direct Known Subclasses

FormBuilder, ViewBuilder

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*args, &block) ⇒ BuilderBase

Returns a new instance of BuilderBase.


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

def initialize(*args, &block)
  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, &block) ⇒ Object


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

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