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.
266 267 268 269 |
# File 'lib/brainstem/dsl/configuration.rb', line 266 def initialize(parent_array = nil) @parent_array = parent_array || [] @storage = [] end |
Instance Method Details
#concat(items) ⇒ Object
276 277 278 |
# File 'lib/brainstem/dsl/configuration.rb', line 276 def concat(items) @storage.concat items end |
#push(item) ⇒ Object Also known as: <<
271 272 273 |
# File 'lib/brainstem/dsl/configuration.rb', line 271 def push(item) @storage.push item end |
#to_a ⇒ Object
280 281 282 |
# File 'lib/brainstem/dsl/configuration.rb', line 280 def to_a @parent_array.to_a + @storage end |