Class: Maven::Tools::DSL::ExclusionDSL

Inherits:
Object
  • Object
show all
Extended by:
Options
Includes:
Models
Defined in:
lib/maven/tools/dsl/exclusions_dsl.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Options

args_and_options, fill_options, help_block

Methods included from Models

#method_missing, #model, #respond_to?

Constructor Details

#initializeExclusionDSL

Returns a new instance of ExclusionDSL.



78
79
80
# File 'lib/maven/tools/dsl/exclusions_dsl.rb', line 78

def initialize
  @model = Exclusion.new
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Maven::Tools::DSL::Models

Class Method Details

.create(dep, *args, &block) ⇒ Object



63
64
65
66
67
68
69
70
71
72
73
74
75
76
# File 'lib/maven/tools/dsl/exclusions_dsl.rb', line 63

def self.create( dep, *args, &block )
  args, options = args_and_options( *args )
  e = ExclusionDSL.new
  case args.size
  when 1
    e.group_id, e.artifact_id = args[0].split( /:/ )
  when 2
    e.group_id, e.artifact_id = *args
  end
  e.instance_eval( &block ) if block
  fill_options( e, options || {} )
  dep.exclusions << e.model
  e
end

Instance Method Details

#helpObject



82
83
84
85
86
87
# File 'lib/maven/tools/dsl/exclusions_dsl.rb', line 82

def help
  warn self.class.help( 'exclusion', :group_id, :artifact_id ) + <<EOS
argument: exclusion 'group_id:artifact_id'
arguments: exclusion 'group_id','artifact_id'
EOS
end

#to_coordinateObject



89
90
91
# File 'lib/maven/tools/dsl/exclusions_dsl.rb', line 89

def to_coordinate
  "#{@model.group_id}:#{@model.artifact_id}"
end