Class: MasterView::TemplateProcessing::Tag
- Inherits:
-
Object
- Object
- MasterView::TemplateProcessing::Tag
- Defined in:
- lib/masterview/parser.rb
Overview
Records information about an element in the document.
A Tag is constructed when the start tag of an element is encountered. It tracks the name of the tag along with any attributes and MasterView directives attached to this element which are invoked during the rendering processing.
– ISSUE: better name for this class would be Element or TemplateElement. Tag is something the element has (in addition to its attributes and content), it’s not what it is. [Deb 22-Sep-2006] ++
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#content ⇒ Object
Returns the value of attribute content.
-
#directives ⇒ Object
Returns the value of attribute directives.
-
#etag ⇒ Object
Returns the value of attribute etag.
-
#mode_type ⇒ Object
Returns the value of attribute mode_type.
-
#parent ⇒ Object
Returns the value of attribute parent.
-
#prolog ⇒ Object
Returns the value of attribute prolog.
-
#renderer ⇒ Object
Returns the value of attribute renderer.
-
#stag ⇒ Object
Returns the value of attribute stag.
-
#tag_name ⇒ Object
Returns the value of attribute tag_name.
Instance Method Summary collapse
-
#create_context(values = {}) ⇒ Object
creates a tag context using tag itself and mode type, also merge in any additional values passed in via values hash.
- #data ⇒ Object
-
#initialize(directives, tag_name, attributes, mode_type, parent, prolog, renderer) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(directives, tag_name, attributes, mode_type, parent, prolog, renderer) ⇒ Tag
Returns a new instance of Tag.
196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
# File 'lib/masterview/parser.rb', line 196 def initialize(directives, tag_name, attributes, mode_type, parent, prolog, renderer) @tag_name = tag_name unless attributes.nil? or attributes.is_a?( CaseInsensitiveHash ) # not a CaseInsensitiveHash so make it one @attributes = CaseInsensitiveHash.new @attributes.replace(attributes) # copy values in else @attributes = attributes end @mode_type = mode_type @directives = directives @stag = [] @content = [] @etag = [] @parent = parent @prolog = prolog @renderer = renderer end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def attributes @attributes end |
#content ⇒ Object
Returns the value of attribute content.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def content @content end |
#directives ⇒ Object
Returns the value of attribute directives.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def directives @directives end |
#etag ⇒ Object
Returns the value of attribute etag.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def etag @etag end |
#mode_type ⇒ Object
Returns the value of attribute mode_type.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def mode_type @mode_type end |
#parent ⇒ Object
Returns the value of attribute parent.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def parent @parent end |
#prolog ⇒ Object
Returns the value of attribute prolog.
195 196 197 |
# File 'lib/masterview/parser.rb', line 195 def prolog @prolog end |
#renderer ⇒ Object
Returns the value of attribute renderer.
195 196 197 |
# File 'lib/masterview/parser.rb', line 195 def renderer @renderer end |
#stag ⇒ Object
Returns the value of attribute stag.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def stag @stag end |
#tag_name ⇒ Object
Returns the value of attribute tag_name.
194 195 196 |
# File 'lib/masterview/parser.rb', line 194 def tag_name @tag_name end |
Instance Method Details
#create_context(values = {}) ⇒ Object
creates a tag context using tag itself and mode type, also merge in any additional values passed in via values hash
218 219 220 221 222 223 |
# File 'lib/masterview/parser.rb', line 218 def create_context( values = {} ) { :tag => self, :mode_type => @mode_type }.merge!(values) end |
#data ⇒ Object
225 226 227 |
# File 'lib/masterview/parser.rb', line 225 def data [] << @stag << @content << @etag end |