Sha256: 0bde85a5133f8adb6ab24d0f7aab87a07364ec5d051b9b0dc000f7eae0eceb5c

Contents?: true

Size: 484 Bytes

Versions: 4

Compression:

Stored size: 484 Bytes

Contents

# frozen_string_literal: true

module RakeFactory
  module Arguments
    def initialize(*args, &)
      arity = method(:initialize).super_method.arity
      super(*args.slice(0, arity), &)
      process_arguments(args)
    end

    def process_arguments(args)
      opts = args.first || {}
      opts.each { |key, value| set_if_parameter(key, value) }
    end

    private

    def set_if_parameter(key, value)
      send("#{key}=", value) if respond_to?("#{key}=")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
rake_factory-0.34.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.34.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.33.0 lib/rake_factory/arguments.rb
rake_factory-0.32.0.pre.6 lib/rake_factory/arguments.rb