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.



284
285
286
# File 'lib/buildr4osgi/eclipse/feature.rb', line 284

def initialize(options_hash) 
  @options_hash = options_hash
end

Instance Method Details

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



288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
# File 'lib/buildr4osgi/eclipse/feature.rb', line 288

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