Class: Brainstem::DSL::Configuration::InheritableAppendSet
- Inherits:
-
Object
- Object
- Brainstem::DSL::Configuration::InheritableAppendSet
- Extended by:
- Forwardable
- Defined in:
- lib/brainstem/dsl/configuration.rb
Overview
An Array-like object that provides ‘push`, `concat`, `each`, `empty?`, and `to_a` methods that act the combination of its own entries and those of a parent InheritableAppendSet, if present.
Instance Method Summary collapse
- #concat(items) ⇒ Object
-
#initialize(parent_array = nil) ⇒ InheritableAppendSet
constructor
A new instance of InheritableAppendSet.
- #push(item) ⇒ Object (also: #<<)
- #to_a ⇒ Object
Constructor Details
#initialize(parent_array = nil) ⇒ InheritableAppendSet
Returns a new instance of InheritableAppendSet.
274 275 276 277 |
# File 'lib/brainstem/dsl/configuration.rb', line 274 def initialize(parent_array = nil) @parent_array = parent_array || [] @storage = [] end |
Instance Method Details
#concat(items) ⇒ Object
284 285 286 |
# File 'lib/brainstem/dsl/configuration.rb', line 284 def concat(items) @storage.concat items end |
#push(item) ⇒ Object Also known as: <<
279 280 281 |
# File 'lib/brainstem/dsl/configuration.rb', line 279 def push(item) @storage.push item end |
#to_a ⇒ Object
288 289 290 |
# File 'lib/brainstem/dsl/configuration.rb', line 288 def to_a @parent_array.to_a + @storage end |