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 6
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 23
def find(name)
  self if @namespace == name
end
render(input) click to toggle source
# File lib/simple_form/wrappers/leaf.rb, line 11
def render(input)
  method = input.method(@namespace)

  if method.arity == 0
    ActiveSupport::Deprecation.warn(SimpleForm::CUSTOM_INPUT_DEPRECATION_WARN % { name: @namespace })

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