Class: MasterView::TemplateProcessing::RenderMode
- Inherits:
-
Object
- Object
- MasterView::TemplateProcessing::RenderMode
- Defined in:
- lib/masterview/parser.rb
Overview
contains tags and output, each output style
Instance Attribute Summary collapse
-
#mode_type ⇒ Object
Returns the value of attribute mode_type.
-
#output ⇒ Object
Returns the value of attribute output.
-
#tags ⇒ Object
Returns the value of attribute tags.
Instance Method Summary collapse
- #determine_method(modifier, tag_name, base) ⇒ Object
- #directives ⇒ Object
-
#initialize(output = nil, mode_type = :normal) ⇒ RenderMode
constructor
A new instance of RenderMode.
- #render_directives(method_name, context = tag.create_context) ⇒ Object
- #tag ⇒ Object
Constructor Details
#initialize(output = nil, mode_type = :normal) ⇒ RenderMode
21 22 23 24 25 |
# File 'lib/masterview/parser.rb', line 21 def initialize(output = nil, mode_type = :normal) @output = output = [] @mode_type = mode_type end |
Instance Attribute Details
#mode_type ⇒ Object
Returns the value of attribute mode_type.
20 21 22 |
# File 'lib/masterview/parser.rb', line 20 def mode_type @mode_type end |
#output ⇒ Object
Returns the value of attribute output.
20 21 22 |
# File 'lib/masterview/parser.rb', line 20 def output @output end |
#tags ⇒ Object
Returns the value of attribute tags.
20 21 22 |
# File 'lib/masterview/parser.rb', line 20 def end |
Instance Method Details
#determine_method(modifier, tag_name, base) ⇒ Object
58 59 60 |
# File 'lib/masterview/parser.rb', line 58 def determine_method(modifier, tag_name, base) type = "#{modifier.to_s}_#{tag_name.to_s}_#{base.to_s}" end |
#directives ⇒ Object
31 32 33 |
# File 'lib/masterview/parser.rb', line 31 def directives .last.directives end |
#render_directives(method_name, context = tag.create_context) ⇒ Object
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/masterview/parser.rb', line 35 def render_directives(method_name, context=tag.create_context) dcs = DirectiveCallStack.new tag_name = tag.tag_name.downcase depth = .size-1 .each do |tag| case depth when 0 dcs << tag.directives.determine_dcs(method_name) when 1 dcs << tag.directives.determine_dcs(determine_method(:child, tag_name, method_name)) dcs << tag.directives.determine_dcs(determine_method(:child, :any, method_name)) dcs << tag.directives.determine_dcs(determine_method(:descendant, tag_name, method_name)) dcs << tag.directives.determine_dcs(determine_method(:descendant, :any, method_name)) else dcs << tag.directives.determine_dcs(determine_method(:descendant, tag_name, method_name)) dcs << tag.directives.determine_dcs(determine_method(:descendant, :any, method_name)) end depth -= 1 end dcs.context = context dcs.render end |
#tag ⇒ Object
27 28 29 |
# File 'lib/masterview/parser.rb', line 27 def tag .last end |