Class: Brainstem::DSL::Configuration::InheritableAppendSet

Inherits:
Object
  • Object
show all
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

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_aObject



288
289
290
# File 'lib/brainstem/dsl/configuration.rb', line 288

def to_a
  @parent_array.to_a + @storage
end