Class: MasterView::TemplateProcessing::DirectiveCallStack

Inherits:
Object
  • Object
show all
Defined in:
lib/masterview/parser.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDirectiveCallStack

Returns a new instance of DirectiveCallStack.



67
68
69
# File 'lib/masterview/parser.rb', line 67

def initialize
  @directives_to_call = []
end

Instance Attribute Details

#contextObject

Returns the value of attribute context.



65
66
67
# File 'lib/masterview/parser.rb', line 65

def context
  @context
end

#directives_to_callObject (readonly)

Returns the value of attribute directives_to_call.



64
65
66
# File 'lib/masterview/parser.rb', line 64

def directives_to_call
  @directives_to_call
end

Instance Method Details

#<<(directive_calls) ⇒ Object



71
72
73
74
75
76
77
78
79
# File 'lib/masterview/parser.rb', line 71

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

#renderObject



81
82
83
84
85
# File 'lib/masterview/parser.rb', line 81

def render
  return [] if @directives_to_call.empty?
  directive_proc = @directives_to_call.shift
  directive_proc.call(self)
end