Class: MasterView::DirectiveCallStack
- Inherits:
-
Object
- Object
- MasterView::DirectiveCallStack
- Defined in:
- lib/masterview/parser.rb
Instance Attribute Summary collapse
-
#context ⇒ Object
Returns the value of attribute context.
-
#directives_to_call ⇒ Object
readonly
Returns the value of attribute directives_to_call.
Instance Method Summary collapse
- #<<(directive_calls) ⇒ Object
-
#initialize ⇒ DirectiveCallStack
constructor
A new instance of DirectiveCallStack.
- #render ⇒ Object
Constructor Details
#initialize ⇒ DirectiveCallStack
Returns a new instance of DirectiveCallStack.
63 64 65 |
# File 'lib/masterview/parser.rb', line 63 def initialize @directives_to_call = [] end |
Instance Attribute Details
#context ⇒ Object
Returns the value of attribute context.
61 62 63 |
# File 'lib/masterview/parser.rb', line 61 def context @context end |
#directives_to_call ⇒ Object (readonly)
Returns the value of attribute directives_to_call.
60 61 62 |
# File 'lib/masterview/parser.rb', line 60 def directives_to_call @directives_to_call end |
Instance Method Details
#<<(directive_calls) ⇒ Object
67 68 69 70 71 72 73 74 75 |
# File 'lib/masterview/parser.rb', line 67 def <<(directive_calls) if directive_calls.is_a? DirectiveCallStack @directives_to_call << directive_calls.directives_to_call else @directives_to_call << directive_calls end @directives_to_call.flatten! self end |
#render ⇒ Object
77 78 79 80 81 |
# File 'lib/masterview/parser.rb', line 77 def render return [] if @directives_to_call.empty? directive_proc = @directives_to_call.shift directive_proc.call(self) end |