Sha256: 48424c2f594d56b5191600d51b466fbb53cdee50252d7e7233a46d0a49ab7ea9

Contents?: true

Size: 522 Bytes

Versions: 9

Compression:

Stored size: 522 Bytes

Contents

# frozen_string_literal: true

module RakeFactory
  module Arguments
    def initialize(*args, &configuration_block)
      arity = method(:initialize).super_method.arity
      super(*args.slice(0, arity), &configuration_block)
      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

9 entries across 9 versions & 1 rubygems

Version Path
rake_factory-0.32.0.pre.5 lib/rake_factory/arguments.rb
rake_factory-0.32.0.pre.4 lib/rake_factory/arguments.rb
rake_factory-0.32.0.pre.3 lib/rake_factory/arguments.rb
rake_factory-0.32.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.32.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.31.0 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.8 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.7 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.6 lib/rake_factory/arguments.rb