Sha256: c9f3ea81fb1b02f3129f3a2334f69b67c4465ee131d5f86a302cf0b0df3e37fb
Contents?: true
Size: 791 Bytes
Versions: 18
Compression:
Stored size: 791 Bytes
Contents
module AngularSprinkles class FormBinder class Base def initialize(_args) @method = _args.fetch(:method) @args = _args.fetch(:args).dup object = _args.fetch(:object) attribute = @args.first.to_sym @attribute_binding = object.bind(attribute) end def call # Let the original form helper raise the exception if helper_is_going_raise_argument_error? return @args end augment_args end private def augment_args; raise NotImplementedError; end def helper_is_going_raise_argument_error? @args.count < required_parameters.count end def required_parameters @method.parameters.select { |i| i.first == :req } end end end end
Version data entries
18 entries across 18 versions & 1 rubygems