class SimpleForm::Wrappers::Leaf

Attributes

namespace[R]

Public Class Methods

new(namespace, options = {}) click to toggle source
# File lib/simple_form/wrappers/leaf.rb, line 7
def initialize(namespace, options = {})
  @namespace = namespace
  @options = options
end

Public Instance Methods

find(name) click to toggle source
# File lib/simple_form/wrappers/leaf.rb, line 24
def find(name)
  self if @namespace == name
end
render(input) click to toggle source
# File lib/simple_form/wrappers/leaf.rb, line 12
def render(input)
  method = input.method(@namespace)

  if method.arity.zero?
    SimpleForm.deprecator.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })

    method.call
  else
    method.call(@options)
  end
end