Class: Osheet::Workbook::ElementStack
- Inherits:
-
Array
- Object
- Array
- Osheet::Workbook::ElementStack
- Defined in:
- lib/osheet/workbook.rb,
lib/osheet/workbook.rb
Overview
This ‘Workbook’ class is really just a scope for workbook builds to run in. All actually workbook metadata is behavior is handled by the ‘WorkbookElement’ class
Instance Method Summary collapse
- #current ⇒ Object
-
#initialize ⇒ ElementStack
constructor
this class is just a wrapper to Array.
- #pop(*args) ⇒ Object
- #push(*args) ⇒ Object
- #size(*args) ⇒ Object
- #using(obj, &block) ⇒ Object
Constructor Details
#initialize ⇒ ElementStack
this class is just a wrapper to Array. I want to treat this as a stack of objects for the workbook DSL to reference. I need to push an object onto the stack, reference it using the ‘current’ method, and pop it off the stack when I’m done.
105 106 107 |
# File 'lib/osheet/workbook.rb', line 105 def initialize super end |
Instance Method Details
#current ⇒ Object
117 118 119 |
# File 'lib/osheet/workbook.rb', line 117 def current self.last end |
#pop(*args) ⇒ Object
113 114 115 |
# File 'lib/osheet/workbook.rb', line 113 def pop(*args) super end |
#push(*args) ⇒ Object
109 110 111 |
# File 'lib/osheet/workbook.rb', line 109 def push(*args) super end |
#size(*args) ⇒ Object
121 122 123 |
# File 'lib/osheet/workbook.rb', line 121 def size(*args) super end |
#using(obj, &block) ⇒ Object
125 126 127 128 129 |
# File 'lib/osheet/workbook.rb', line 125 def using(obj, &block) push(obj) block.call if !block.nil? pop end |