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.
263 264 265 266 |
# File 'lib/brainstem/dsl/configuration.rb', line 263 def initialize(parent_array = nil) @parent_array = parent_array || [] @storage = [] end |
Instance Method Details
#concat(items) ⇒ Object
273 274 275 |
# File 'lib/brainstem/dsl/configuration.rb', line 273 def concat(items) @storage.concat items end |
#push(item) ⇒ Object Also known as: <<
268 269 270 |
# File 'lib/brainstem/dsl/configuration.rb', line 268 def push(item) @storage.push item end |
#to_a ⇒ Object
277 278 279 |
# File 'lib/brainstem/dsl/configuration.rb', line 277 def to_a @parent_array.to_a + @storage end |