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.



39
40
41
# File 'lib/rouge/util.rb', line 39

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

Instance Method Details

#each(&b) ⇒ Object



47
48
49
50
51
52
# File 'lib/rouge/util.rb', line 47

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

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

#own_entriesObject



54
55
56
# File 'lib/rouge/util.rb', line 54

def own_entries
  @own_entries ||= []
end

#parentObject



43
44
45
# File 'lib/rouge/util.rb', line 43

def parent
  @parent ||= []
end

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



58
59
60
# File 'lib/rouge/util.rb', line 58

def push(o)
  own_entries << o
end