Class: Maven::Model::ResourceArray
- Inherits:
-
Array
- Object
- Array
- Maven::Model::ResourceArray
- Defined in:
- lib/maven/model/utils.rb
Instance Method Summary collapse
- #add(&block) ⇒ Object (also: #<<)
-
#initialize(name = 'resources', child = Resource, &block) ⇒ ResourceArray
constructor
A new instance of ResourceArray.
Constructor Details
#initialize(name = 'resources', child = Resource, &block) ⇒ ResourceArray
Returns a new instance of ResourceArray.
139 140 141 142 143 144 145 146 |
# File 'lib/maven/model/utils.rb', line 139 def initialize( name = 'resources', child = Resource, &block ) @_child = child #super( name, &block ) if block block.call self end self end |
Instance Method Details
#add(&block) ⇒ Object Also known as: <<
150 151 152 153 154 155 |
# File 'lib/maven/model/utils.rb', line 150 def add( &block ) r = @_child.new block.call( r ) do_add r r end |