Class: Rouge::InheritableList
- Inherits:
-
Object
- Object
- Rouge::InheritableList
- Includes:
- Enumerable
- Defined in:
- lib/rouge/util.rb
Instance Method Summary collapse
- #each(&b) ⇒ Object
-
#initialize(parent = nil) ⇒ InheritableList
constructor
A new instance of InheritableList.
- #own_entries ⇒ Object
- #parent ⇒ Object
- #push(o) ⇒ Object (also: #<<)
Constructor Details
#initialize(parent = nil) ⇒ InheritableList
Returns a new instance of InheritableList.
42 43 44 |
# File 'lib/rouge/util.rb', line 42 def initialize(parent=nil) @parent = parent end |
Instance Method Details
#each(&b) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/rouge/util.rb', line 50 def each(&b) return enum_for(:each) unless block_given? parent.each(&b) own_entries.each(&b) end |
#own_entries ⇒ Object
57 58 59 |
# File 'lib/rouge/util.rb', line 57 def own_entries @own_entries ||= [] end |
#parent ⇒ Object
46 47 48 |
# File 'lib/rouge/util.rb', line 46 def parent @parent ||= [] end |
#push(o) ⇒ Object Also known as: <<
61 62 63 |
# File 'lib/rouge/util.rb', line 61 def push(o) own_entries << o end |