Class: Buildr4OSGi::ArrayAddWithOptions

Inherits:
Array
  • Object
show all
Defined in:
lib/buildr4osgi/eclipse/feature.rb

Instance Method Summary collapse

Constructor Details

#initialize(options_hash) ⇒ ArrayAddWithOptions

Returns a new instance of ArrayAddWithOptions.



297
298
299
# File 'lib/buildr4osgi/eclipse/feature.rb', line 297

def initialize(options_hash) 
  @options_hash = options_hash
end

Instance Method Details

#add_with_options(*args) ⇒ Object Also known as: <<



301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/buildr4osgi/eclipse/feature.rb', line 301

def add_with_options(*args)
  plugin = args.shift
  options = {}
  while(!args.empty?)
    option = args.shift
    case
    when option.is_a?(Hash)
      options.merge!(option)
    when option.is_a?(Symbol)
      options.merge!({option => true})
    else
      raise "Impossible to find what this option means: #{option}"
    end
  end
  add(plugin)
  @options_hash[plugin] = options
end