Class: Kwartz::ElementInfo
- Inherits:
-
Object
- Object
- Kwartz::ElementInfo
- Defined in:
- lib/kwartz/converter.rb
Instance Attribute Summary collapse
-
#append_exprs ⇒ Object
Returns the value of attribute append_exprs.
-
#attr_info ⇒ Object
Returns the value of attribute attr_info.
-
#cont_expr ⇒ Object
readonly
Returns the value of attribute cont_expr.
-
#cont_stmts ⇒ Object
Returns the value of attribute cont_stmts.
-
#elem_expr ⇒ Object
readonly
Returns the value of attribute elem_expr.
-
#etag_expr ⇒ Object
readonly
Returns the value of attribute etag_expr.
-
#etag_info ⇒ Object
Returns the value of attribute etag_info.
-
#logic ⇒ Object
Returns the value of attribute logic.
-
#name ⇒ Object
Returns the value of attribute name.
-
#stag_expr ⇒ Object
readonly
Returns the value of attribute stag_expr.
-
#stag_info ⇒ Object
Returns the value of attribute stag_info.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, stag_info, etag_info, cont_stmts, attr_info, append_exprs) ⇒ ElementInfo
constructor
A new instance of ElementInfo.
- #merge(elem_ruleset) ⇒ Object
- #merged? ⇒ Boolean
Constructor Details
#initialize(name, stag_info, etag_info, cont_stmts, attr_info, append_exprs) ⇒ ElementInfo
Returns a new instance of ElementInfo.
156 157 158 159 160 161 162 163 164 165 |
# File 'lib/kwartz/converter.rb', line 156 def initialize(name, stag_info, etag_info, cont_stmts, attr_info, append_exprs) @name = name # String @stag_info = stag_info # TagInfo @etag_info = etag_info # TagInfo @cont_stmts = cont_stmts # list of Statement @attr_info = attr_info # AttrInfo @append_exprs = append_exprs # list of NativeExpression @logic = [ ExpandStatement.new(:elem, @name) ] @merged = nil end |
Instance Attribute Details
#append_exprs ⇒ Object
Returns the value of attribute append_exprs.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def append_exprs @append_exprs end |
#attr_info ⇒ Object
Returns the value of attribute attr_info.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def attr_info @attr_info end |
#cont_expr ⇒ Object (readonly)
Returns the value of attribute cont_expr.
168 169 170 |
# File 'lib/kwartz/converter.rb', line 168 def cont_expr @cont_expr end |
#cont_stmts ⇒ Object
Returns the value of attribute cont_stmts.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def cont_stmts @cont_stmts end |
#elem_expr ⇒ Object (readonly)
Returns the value of attribute elem_expr.
168 169 170 |
# File 'lib/kwartz/converter.rb', line 168 def elem_expr @elem_expr end |
#etag_expr ⇒ Object (readonly)
Returns the value of attribute etag_expr.
168 169 170 |
# File 'lib/kwartz/converter.rb', line 168 def etag_expr @etag_expr end |
#etag_info ⇒ Object
Returns the value of attribute etag_info.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def etag_info @etag_info end |
#logic ⇒ Object
Returns the value of attribute logic.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def logic @logic end |
#name ⇒ Object
Returns the value of attribute name.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def name @name end |
#stag_expr ⇒ Object (readonly)
Returns the value of attribute stag_expr.
168 169 170 |
# File 'lib/kwartz/converter.rb', line 168 def stag_expr @stag_expr end |
#stag_info ⇒ Object
Returns the value of attribute stag_info.
167 168 169 |
# File 'lib/kwartz/converter.rb', line 167 def stag_info @stag_info end |
Class Method Details
.create(values = {}) ⇒ Object
176 177 178 |
# File 'lib/kwartz/converter.rb', line 176 def self.create(values={}) self.new(values[:name], values[:stag], values[:etag], values[:cont], values[:attr], values[:append]) end |
Instance Method Details
#merge(elem_ruleset) ⇒ Object
181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/kwartz/converter.rb', line 181 def merge(elem_ruleset) return unless elem_ruleset.name == @name @merged = elem_ruleset @stag_expr = _to_native_expr(elem_ruleset.stag) @cont_expr = _to_native_expr(elem_ruleset.cont || elem_ruleset.value) @etag_expr = _to_native_expr(elem_ruleset.etag) @elem_expr = _to_native_expr(elem_ruleset.elem) if @cont_expr @cont_stmts = [ PrintStatement.new([@cont_expr]) ] @stag_info.tail_space = '' @etag_info.head_space = '' @etag_info.rebuild_tag_text() end elem_ruleset.remove.each do |aname| @attr_info.delete(aname) end if elem_ruleset.remove elem_ruleset.attrs.each do |aname, avalue| @attr_info[aname] = _to_native_expr(avalue) end if elem_ruleset.attrs elem_ruleset.append.each do |expr| (@append_exprs ||= []) << _to_native_expr(expr) end if elem_ruleset.append @tagname = elem_ruleset.tagname @logic = elem_ruleset.logic if elem_ruleset.logic end |
#merged? ⇒ Boolean
171 172 173 |
# File 'lib/kwartz/converter.rb', line 171 def merged? !@merged.nil? end |