Sha256: 307f6eca9b49bb90ea1d1b301af1365e6119643dd0c0e9797254d0bb59dd41f4

Contents?: true

Size: 575 Bytes

Versions: 12

Compression:

Stored size: 575 Bytes

Contents

module SimpleForm
  module Wrappers
    class Leaf
      attr_reader :namespace

      def initialize(namespace, options = {})
        @namespace = namespace
        @options = options
      end

      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

      def find(name)
        self if @namespace == name
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
simple_form-3.5.0 lib/simple_form/wrappers/leaf.rb
enju_leaf-1.2.1 vendor/bundle/ruby/2.3/gems/simple_form-3.4.0/lib/simple_form/wrappers/leaf.rb
simple_form-3.4.0 lib/simple_form/wrappers/leaf.rb
simple_form-3.3.1 lib/simple_form/wrappers/leaf.rb
simple_form-3.3.0 lib/simple_form/wrappers/leaf.rb
simple_form-3.2.1 lib/simple_form/wrappers/leaf.rb
sc_core-0.0.7 test/dummy/vendor/bundle/ruby/2.2.0/gems/simple_form-3.2.0/lib/simple_form/wrappers/leaf.rb
simple_form-3.2.0 lib/simple_form/wrappers/leaf.rb
simple_form-3.1.1 lib/simple_form/wrappers/leaf.rb
simple_form-3.1.0 lib/simple_form/wrappers/leaf.rb
simple_form-3.1.0.rc2 lib/simple_form/wrappers/leaf.rb
simple_form-3.1.0.rc1 lib/simple_form/wrappers/leaf.rb