Class: Meteor::Element
- Inherits:
-
Object
- Object
- Meteor::Element
- Defined in:
- lib/meteor.rb
Overview
Element Class (要素クラス)
Direct Known Subclasses
Instance Attribute Summary (collapse)
-
- (Object) attributes
- String
-
attributes (属性群).
-
- (Object) copy
- Meteor::Element
-
copy pointer (複製ポインタ).
-
- (Object) cx
- true,false
-
comment extension tag flag (コメント拡張タグフラグ).
-
- (Object) document_sync
- true,false
-
document update flag (ドキュメント更新フラグ).
-
- (Object) empty
- true,false
-
content empty flag (内容存在フラグ).
-
- (Object) mixed_content
- String
-
content (内容).
-
- (Object) mono
- true,false
-
child element existance flag (子要素存在フラグ).
-
- (Object) name
- String
-
element name (要素名).
-
- (Object) origin
- true,false
-
usable flag (有効・無効フラグ)
- Meteor::Element
-
original pointer (原本ポインタ).
-
- (Object) parser
- Meteor::Parser
-
parser(パーサ).
-
- (Object) pattern
- String
-
pattern (パターン).
-
- (Object) removed
- true,false
-
delete flag (削除フラグ).
-
- (Object) type_value
- String
-
タイプ属性.
-
- (Object) usable
Returns the value of attribute usable.
Class Method Summary (collapse)
-
+ (Meteor::Element) new!(elm, ps)
make copy (コピーを作成する).
Instance Method Summary (collapse)
-
- (String) [](name)
属性の値を取得する.
-
- (Meteor::Element) []=(name, value)
set attribute (属性をセットする).
- - (Object) attr(attrs, *args)
- - (Object) attr_map(*args)
-
- (Meteor::Element) clone
clone (複製する).
- - (Object) content(*args)
-
- (Meteor::Element) content=(value)
set content of element (内容をセットする).
-
- (Object) cxtag(*args)
get cx(comment extension) tag (CX(コメント拡張)タグを取得する).
-
- (String) document
get document (ドキュメントを取得する).
-
- (Object) document=(doc)
set document (ドキュメントをセットする).
-
- (Object) element(elm = nil, attrs = nil, *args)
(also: #child)
get element (要素を取得する).
- - (Object) execute(*args)
-
- (Meteor::Element) find(selector)
get child element using selector (子要素を取得する).
-
- (Object) flush
reflect (反映する).
-
- (Element) initialize(*args)
constructor
initializer (イニシャライザ).
-
- (Object) remove
remove element (要素を削除する).
-
- (Meteor::Element) remove_attr(attr_name)
remove attribute of element (要素の属性を消す).
Constructor Details
- (Element) initialize(name) - (Element) initialize(elm) - (Element) initialize(elm, ps)
initializer (イニシャライザ)
60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/meteor.rb', line 60 def initialize(*args) case args.length when ONE if args[0].kind_of?(String) then initialize_s(args[0]) elsif args[0].kind_of?(Meteor::Element) initialize_e(args[0]) else raise ArgumentError end when TWO @name = args[0].name @attributes = String.new(args[0].attributes) @mixed_content = String.new(args[0].mixed_content) #@pattern = String.new(args[0].pattern) @pattern = args[0].pattern @document = String.new(args[0].document) @empty = args[0].empty @cx = args[0].cx @mono = args[0].mono @parser = args[1] #@usable = false @origin = args[0] args[0].copy = self else raise ArgumentError end end |
Instance Attribute Details
- (Object) attributes
- String
-
attributes (属性群)
177 178 179 |
# File 'lib/meteor.rb', line 177 def attributes @attributes end |
- (Object) copy
- Meteor::Element
-
copy pointer (複製ポインタ)
188 189 190 |
# File 'lib/meteor.rb', line 188 def copy @copy end |
- (Object) cx
- true,false
-
comment extension tag flag (コメント拡張タグフラグ)
182 183 184 |
# File 'lib/meteor.rb', line 182 def cx @cx end |
- (Object) document_sync
- true,false
-
document update flag (ドキュメント更新フラグ)
180 181 182 |
# File 'lib/meteor.rb', line 180 def document_sync @document_sync end |
- (Object) empty
- true,false
-
content empty flag (内容存在フラグ)
181 182 183 |
# File 'lib/meteor.rb', line 181 def empty @empty end |
- (Object) mixed_content
- String
-
content (内容)
178 179 180 |
# File 'lib/meteor.rb', line 178 def mixed_content @mixed_content end |
- (Object) mono
- true,false
-
child element existance flag (子要素存在フラグ)
183 184 185 |
# File 'lib/meteor.rb', line 183 def mono @mono end |
- (Object) name
- String
-
element name (要素名)
176 177 178 |
# File 'lib/meteor.rb', line 176 def name @name end |
- (Object) origin
- true,false
-
usable flag (有効・無効フラグ)
- Meteor::Element
-
original pointer (原本ポインタ)
187 188 189 |
# File 'lib/meteor.rb', line 187 def origin @origin end |
- (Object) parser
- Meteor::Parser
-
parser(パーサ)
184 185 186 |
# File 'lib/meteor.rb', line 184 def parser @parser end |
- (Object) pattern
- String
-
pattern (パターン)
179 180 181 |
# File 'lib/meteor.rb', line 179 def pattern @pattern end |
- (Object) removed
- true,false
-
delete flag (削除フラグ)
189 190 191 |
# File 'lib/meteor.rb', line 189 def removed @removed end |
- (Object) type_value
- String
-
タイプ属性
185 186 187 |
# File 'lib/meteor.rb', line 185 def type_value @type_value end |
- (Object) usable
Returns the value of attribute usable
186 187 188 |
# File 'lib/meteor.rb', line 186 def usable @usable end |
Class Method Details
+ (Meteor::Element) new!(elm, ps)
make copy (コピーを作成する)
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 |
# File 'lib/meteor.rb', line 136 def self.new!(*args) case args.length when TWO @obj = args[1].element_hook if @obj then @obj.attributes = String.new(args[0].attributes) @obj.mixed_content = String.new(args[0].mixed_content) #@obj.pattern = String.new(args[0].pattern) @obj.document = String.new(args[0].document) @obj else @obj = self.new(args[0], args[1]) args[1].element_hook = @obj @obj end else raise ArgumentError end end |
Instance Method Details
- (String) [](name)
属性の値を取得する
398 399 400 |
# File 'lib/meteor.rb', line 398 def [](name) @parser.attr(self, name) end |
- (Meteor::Element) []=(name, value)
set attribute (属性をセットする)
389 390 391 |
# File 'lib/meteor.rb', line 389 def []=(name, value) @parser.attr(self, name, value) end |
- (Meteor::Element) attr(attr) - (Meteor::Element) attr(attr_name, attr_value) - (String) attr(attr_name)
339 340 341 |
# File 'lib/meteor.rb', line 339 def attr(attrs,*args) @parser.attr(self, attrs,*args) end |
- (Meteor::Element) attr_map(attr_map) - (Meteor::AttributeMap) attr_map
352 353 354 |
# File 'lib/meteor.rb', line 352 def attr_map(*args) @parser.attr_map(self, *args) end |
- (Meteor::Element) clone
clone (複製する)
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
# File 'lib/meteor.rb', line 160 def clone obj = self.parser.element_cache[self.object_id] if obj then obj.attributes = String.new(self.attributes) obj.mixed_content = String.new(self.mixed_content) #obj.pattern = String.new(self.pattern) obj.document = String.new(self.document) obj.usable = true obj else obj = self.new(self) self.parser.element_cache[self.object_id] = obj obj end end |
- (Meteor::Element) content(content, entity_ref = true) - (Meteor::Element) content(content) - (String) content
370 371 372 |
# File 'lib/meteor.rb', line 370 def content(*args) @parser.content(self, *args) end |
- (Meteor::Element) content=(value)
set content of element (内容をセットする)
379 380 381 |
# File 'lib/meteor.rb', line 379 def content=(value) @parser.content(self, value) end |
- (Meteor::Element) cxtag(elm_name, id) - (Meteor::Element) cxtag(id)
get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
320 321 322 |
# File 'lib/meteor.rb', line 320 def cxtag(*args) @parser.cxtag(*args) end |
- (String) document
get document (ドキュメントを取得する)
204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 |
# File 'lib/meteor.rb', line 204 def document if @document_sync then @document_sync = false case @parser.doc_type when Parser::HTML, Parser::HTML5 then if @cx then #@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4 @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->" else if @empty then #@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>" else @document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE end end when Parser::XHTML, Parser::XHTML5, Parser::XML then if @cx then #@pattern_cc = '' << SET_CX_1 << elm.name << SPACE << elm.attributes << SET_CX_2 << elm.mixed_content << SET_CX_3 << elm.name << SET_CX_4 @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->" else if @empty then #@pattern_cc = '' << TAG_OPEN << elm.name << elm.attributes << TAG_CLOSE << elm.mixed_content << TAG_OPEN3 << elm.name << TAG_CLOSE @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>" else @document = '' << Meteor::Core::Kernel::TAG_OPEN << @name << @attributes << Meteor::Core::Kernel::TAG_CLOSE3 end end end else @document end end |
- (Object) document=(doc)
set document (ドキュメントをセットする)
195 196 197 198 |
# File 'lib/meteor.rb', line 195 def document=(doc) @document_sync = false @document = doc end |
- (Meteor::Element) element - (Meteor::Element) element(elm_name) - (Meteor::Element) element(elm_name, attrs) - (Meteor::Element) element(attrs) - (Meteor::Element) element(elm_name, attr_name, attr_value) - (Meteor::Element) element(attr_name, attr_value) - (Meteor::Element) element(elm_name, attr_name1, attr_value1, attr_name2, attr_value2) - (Meteor::Element) element(attr_name1, attr_value1, attr_name2, attr_value2) - (Meteor::Element) element(elm) Also known as: child
get element (要素を取得する)
287 288 289 290 291 292 293 294 295 |
# File 'lib/meteor.rb', line 287 def element(elm = nil, attrs = nil,*args) #case args.length #when ZERO if !elm && !attrs @parser.element(self) else @parser.element(elm, attrs,*args) end end |
- (Object) execute(hook) - (Object) execute(loop, list)
434 435 436 |
# File 'lib/meteor.rb', line 434 def execute(*args) @parser.execute(self, *args) end |
- (Meteor::Element) find(selector)
get child element using selector (子要素を取得する)
304 305 306 |
# File 'lib/meteor.rb', line 304 def find(selector) @parser.find(selector) end |
- (Object) flush
reflect (反映する)
421 422 423 |
# File 'lib/meteor.rb', line 421 def flush @parser.flush end |
- (Object) remove
remove element (要素を削除する)
414 415 416 |
# File 'lib/meteor.rb', line 414 def remove @parser.remove_element(self) end |
- (Meteor::Element) remove_attr(attr_name)
remove attribute of element (要素の属性を消す)
407 408 409 |
# File 'lib/meteor.rb', line 407 def remove_attr(attr_name) @parser.remove_attr(self, attr_name) end |