Sha256: 7bba1fc4401a9323e6d984a84aef4947754b614e2c77f1c63c44fcec327cc728

Contents?: true

Size: 524 Bytes

Versions: 22

Compression:

Stored size: 524 Bytes

Contents

module RakeFactory
  module Arguments
    def initialize(*args, &configuration_block)
      arity = self.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)
      if self.respond_to?("#{key}=")
        self.send("#{key}=", value)
      end
    end
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
rake_factory-0.17.0 lib/rake_factory/arguments.rb
rake_factory-0.16.0.pre.1 lib/rake_factory/arguments.rb