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.30.0.pre.5 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.4 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.3 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.30.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.29.0 lib/rake_factory/arguments.rb
rake_factory-0.28.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.28.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.27.0 lib/rake_factory/arguments.rb
rake_factory-0.26.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.24.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.25.0 lib/rake_factory/arguments.rb
rake_factory-0.24.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.23.0 lib/rake_factory/arguments.rb
rake_factory-0.22.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.21.0 lib/rake_factory/arguments.rb
rake_factory-0.20.0.pre.1 lib/rake_factory/arguments.rb
rake_factory-0.19.0 lib/rake_factory/arguments.rb
rake_factory-0.18.0.pre.2 lib/rake_factory/arguments.rb
rake_factory-0.18.0.pre.1 lib/rake_factory/arguments.rb