Class: Maven::Model::License

Inherits:
Tag
  • Object
show all
Defined in:
lib/maven/model/model.rb

Instance Method Summary collapse

Methods inherited from Tag

#_name, _tags, #comment, prepend_tags, tags, #to_xml

Constructor Details

#initialize(*args) ⇒ License

Returns a new instance of License.



327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/maven/model/model.rb', line 327

def initialize(*args)
  case args.size
  when 1
    @url = args[0]
    @name = args[0].sub(/.*\//, '').sub(/\.\w+/, '')
  when 2
    @url = args[0]
    @name = args[1]
  when 3
    @url = args[0]
    @name = args[1]
    @distribution = args[2]
  end
  @url = "./#{url}" unless @url =~ /^\.\// || @url =~ /^https?:\/\//
  @distribution = "repo" unless @distribution
  self
end