Sha256: c4f3fc688e6faf7122f15d69e27ed98fbc1dccc6d7a077e84d215b5bb1ca1ef6

Contents?: true

Size: 554 Bytes

Versions: 1

Compression:

Stored size: 554 Bytes

Contents

module AngularSprinkles
  class FormBinder
    class Default < Base
      private

      def args_with_binding
        binding = { 'ng-model' => @attribute_binding }

        @args.tap do |args|
          # Assume that optional params default to {}
          # This is a safe assumption for all helpers except check_box
          (@method.arity.abs - args.count).times { args.push({}) }

          # The last argument is always the one where ng-model should be appended
          args.last.reverse_merge!(binding)
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
angular_sprinkles-0.2.0 lib/angular_sprinkles/form_binder/default.rb