Class: Rouge::InheritableList

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/rouge/util.rb

Instance Method Summary collapse

Constructor Details

#initialize(parent = nil) ⇒ InheritableList

Returns a new instance of InheritableList.


41
42
43
# File 'lib/rouge/util.rb', line 41

def initialize(parent=nil)
  @parent = parent
end

Instance Method Details

#each(&b) ⇒ Object


49
50
51
52
53
54
# File 'lib/rouge/util.rb', line 49

def each(&b)
  return enum_for(:each) unless block_given?

  parent.each(&b)
  own_entries.each(&b)
end

#own_entriesObject


56
57
58
# File 'lib/rouge/util.rb', line 56

def own_entries
  @own_entries ||= []
end

#parentObject


45
46
47
# File 'lib/rouge/util.rb', line 45

def parent
  @parent ||= []
end

#push(o) ⇒ Object Also known as: <<


60
61
62
# File 'lib/rouge/util.rb', line 60

def push(o)
  own_entries << o
end