Class: Meteor::Element

Inherits:
Object
  • Object
show all
Defined in:
lib/meteor/element.rb

Overview

Element Class (要素クラス)

Direct Known Subclasses

RootElement

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Element #initialize(elm) ⇒ Element #initialize(elm, ps) ⇒ Element

initializer (イニシャライザ)

Overloads:



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
# File 'lib/meteor/element.rb', line 72

def initialize(*args)
  case args.length
  when Meteor::ONE
    if args[0].kind_of?(String)
      initialize_s(args[0])
    elsif args[0].kind_of?(Meteor::Element)
      initialize_e(args[0])
    else
      raise ArgumentError
    end
  when Meteor::TWO
    initialize_2(args[0], args[1])
  when Meteor::ZERO
  else
    raise ArgumentError
  end
end

Instance Attribute Details

#attributesString

Returns attributes (属性群).

Returns:

  • (String)

    attributes (属性群)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#copyMeteor::Element

Returns copy pointer (複製ポインタ).

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#cxtrue, false

Returns comment extension tag flag (コメント拡張タグフラグ).

Returns:

  • (true, false)

    comment extension tag flag (コメント拡張タグフラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#document_synctrue, false

Returns document update flag (ドキュメント更新フラグ).

Returns:

  • (true, false)

    document update flag (ドキュメント更新フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#mixed_contentString

Returns content (内容).

Returns:

  • (String)

    content (内容)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#monotrue, false

Returns child element existance flag (子要素存在フラグ).

Returns:

  • (true, false)

    child element existance flag (子要素存在フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#nameString Also known as: tag

Returns tag name (要素名).

Returns:

  • (String)

    tag name (要素名)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#normaltrue, false Also known as: empty

Returns content normal flag (内容存在フラグ).

Returns:

  • (true, false)

    content normal flag (内容存在フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#originMeteor::Element

Returns original pointer (原本ポインタ).

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#parserMeteor::Parser

Returns parser(パーサ).

Returns:



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#patternString

Returns pattern (パターン).

Returns:

  • (String)

    pattern (パターン)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#raw_contentfalse, true

Returns entity ref flag of content (内容のエンティティ参照フラグ).

Returns:

  • (false, true)

    entity ref flag of content (内容のエンティティ参照フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#removedtrue, false

Returns deletion flag (削除フラグ).

Returns:

  • (true, false)

    deletion flag (削除フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#type_valueString

Returns type (タイプ属性).

Returns:

  • (String)

    type (タイプ属性)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

#usabletrue, false

Returns usable flag (有効・無効フラグ).

Returns:

  • (true, false)

    usable flag (有効・無効フラグ)



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
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
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
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
# File 'lib/meteor/element.rb', line 39

class Element
  attr_accessor :name
  attr_accessor :attributes
  attr_accessor :mixed_content
  attr_accessor :raw_content
  attr_accessor :pattern
  attr_accessor :document_sync
  attr_accessor :normal
  attr_accessor :cx
  attr_accessor :mono
  attr_accessor :parser
  attr_accessor :type_value
  attr_accessor :usable
  attr_accessor :origin
  attr_accessor :copy
  attr_accessor :removed

  alias_method :tag, :name
  alias_method :tag=, :name=

  alias_method :empty, :normal
  alias_method :empty=, :normal=

  #
  # initializer (イニシャライザ)
  # @overload initialize(name)
  #  @param [String,Symbol] name tag name (タグ名)
  # @overload initialize(elm)
  #  @param [Meteor::Element] elm element (要素)
  # @overload initialize(elm,ps)
  #  @param [Meteor::Element] elm element (要素)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #
  def initialize(*args)
    case args.length
    when Meteor::ONE
      if args[0].kind_of?(String)
        initialize_s(args[0])
      elsif args[0].kind_of?(Meteor::Element)
        initialize_e(args[0])
      else
        raise ArgumentError
      end
    when Meteor::TWO
      initialize_2(args[0], args[1])
    when Meteor::ZERO
    else
      raise ArgumentError
    end
  end

  #
  # initializer (イニシャライザ)
  # @param [String] name tag name (タグ名)
  #
  def initialize_s(name)
    @name = name
    # @attributes = nil
    # @mixed_content = nil
    # @pattern = nil
    # @document = nil
    # @parser=nil
    # @normal = false
    # @cx = false
    # @mono = false
    # @parent = false
    @usable = true
  end

  private :initialize_s

  #
  # initializer (イニシャライザ)
  # @param [Meteor::Element] elm element (要素)
  #
  def initialize_e(elm)
    if self.normal
      self.parser.element(elm)
    else
      @name = elm.name
      @attributes = String.new(elm.attributes)
      # @pattern = String.new(elm.pattern)
      @pattern = elm.pattern
      @document = String.new(elm.document)
      @normal = elm.normal
      @cx = elm.cx
      @mono = elm.mono
      @origin = elm
      @parser = elm.parser
      @usable = true
    end
  end

  private :initialize_e

  def initialize_2(elm, ps)
    @name = elm.name
    @attributes = String.new(elm.attributes)
    @mixed_content = String.new(elm.mixed_content)
    # @pattern = String.new(elm.pattern)
    @pattern = elm.pattern
    @document = String.new(elm.document)
    @normal = elm.normal
    @cx = elm.cx
    @mono = elm.mono
    @parser = ps
    # @usable = false
    @origin = elm
    elm.copy = self
  end

  private :initialize_2

  #
  # clone (複製する)
  # @overload clone()
  #  @return [Meteor::Element] element (要素)
  # @overload clone(ps)
  #  @param [Meteor::Parser] ps parser (パーサ)
  #  @return [Meteor::Element] element (要素)
  #
  def clone(*args)
    case args.length
    when Meteor::ZERO
      clone_0
    when Meteor::ONE
      clone_1(args[0])
    end
  end

  #
  # clone (複製する)
  # @return [Meteor::Element] element (要素)
  #
  def clone_0
    obj = self.parser.element_cache[self.object_id]
    if obj
      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.class.new(self)
      self.parser.element_cache[self.object_id] = obj
      obj
    end
  end

  private :clone_0

  #
  # clone (複製する)
  # @param [Meteor::Parser] ps parser (パーサ)
  # @return [Meteor::Element] element (要素)
  #
  def clone_1(ps)
    obj = ps.element_hook
    if obj
      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
    else
      obj = self.class.new(self, ps)
      ps.element_hook = obj
      obj
    end
  end

  private :clone_1

  #
  # set document (ドキュメントをセットする)
  # @param [String] doc document (ドキュメント)
  #
  def document=(doc)
    @document_sync = false
    @document = doc
  end

  #
  # get document (ドキュメントを取得する)
  # @return [String] document (ドキュメント)
  #
  def document
    if @document_sync
      @document_sync = false
      case @parser.doc_type
      when Parser::HTML, Parser::HTML4
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << ">"
            # @document = "<#{@name}#{@attributes}>"
          end
        end
      when Parser::XHTML, Parser::XHTML4, Parser::XML
        if @cx
          # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
          @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
        else
          if @normal
            # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
            @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
          else
            @document = String.new("") << "<" << @name << @attributes << "/>"
            # @document = "<#{@name}#{@attributes}/>"
          end
        end
      end
    else
      @document
    end
  end

  #
  # get element (要素を取得する)
  # @overload element()
  #  get element (要素を取得する)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name)
  #  get element using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attrs)
  #  get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attrs)
  #  get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Meteor::Element] element(要素)
  # @overload element(name,attr_name,attr_value)
  #  get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name,attr_value)
  #  get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name 属性名
  #  @param [String] attr_value 属性値
  #  @return [Meteor::Element] element (要素)
  # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Meteor::Element] element (要素)
  # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 属性名1
  #  @param [String] attr_value1 属性値1
  #  @param [String,Symbol] attr_name2 属性名2
  #  @param [String] attr_value2 属性値2
  #  @return [Meteor::Element] element(要素)
  # @overload element(elm)
  #  mirror element (要素を射影する)
  #  @param [Meteor::Element] elm element(要素)
  #  @return [Meteor::Element] element(要素)
  #
  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

  alias_method :child, :element

  #
  # get elements (要素を取得する)
  # @overload elements(name)
  #  get elements using tag name (要素のタグ名で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @return [Array<Meteor::Element>] element array(要素配列)
  # @overload elements(name,attrs)
  #  get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attrs)
  #  get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name,attr_value)
  #  get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name,attr_value)
  #  get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String] attr_value attribute value (属性値)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
  #  get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
  #  @param [String,Symbol] attr_name1 attribute name1 (属性名1)
  #  @param [String] attr_value1 attribute value1 (属性値1)
  #  @param [String,Symbol] attr_name2 attribute name2 (属性名2)
  #  @param [String] attr_value2 attribute value2 (属性値2)
  #  @return [Array<Meteor::Element>] element array (要素配列)
  #
  def elements(*args)
    @parser.elements(*args)
  end

  #
  # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
  # CSS3 selector partial support (CSS3セレクタの部分的サポート)
  # @param selector [String] selector (セレクタ)
  # @return [Array<Meteor::Element>] element (要素)
  #
  def find(selector)
    @parser.find(selector)
  end

  alias_method :css, :find

  #
  # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
  # @overload cxtag(name,id)
  #  get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String,Symbol] name tag name (タグ名)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element(要素)
  # @overload cxtag(id)
  #  get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
  #  @param [String] id id attribute value (ID属性値)
  #  @return [Meteor::Element] element (要素)
  #
  def cxtag(*args)
    @parser.cxtag(*args)
  end

  #
  # @overload attr(attr)
  #  set attribute of element (要素の属性をセットする)
  #  @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr(attr_name,attr_value)
  #  set attribute of element (要素の属性をセットする)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @param [String,true,false] attr_value attribute value (属性値)
  #  @return [Meteor::Element] element (要素)
  # @overload attr(attr_name)
  #  get attribute value of element (要素の属性値を取得する)
  #  @param [String,Symbol] attr_name attribute name (属性名)
  #  @return [String] attribute value (属性値)
  #
  def attr(attrs, *args)
    @parser.attr(self, attrs, *args)
  end

  #
  # set attribute of element (要素の属性をセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
  # @return [Meteor::Element] element (要素)
  #
  def attr=(attr)
    @parser.attr(self, attr)
  end

  #
  # set attribute map (要素マップをセットする)
  # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  def attrs=(attrs)
    @parser.attrs(self, attrs)
  end

  #
  # get attribute map (属性マップを取得する)
  # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
  #
  def attrs
    @parser.attrs(self)
  end

  #
  # @overload attr_map(attr_map)
  #  set attribute map (属性マップをセットする)
  #  @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload attr_map()
  #  get attribute map (属性マップを取得する)
  #  @return [Meteor::AttributeMap] attribute map (属性マップ)
  #
  def attr_map(*args)
    @parser.attr_map(self, *args)
  end

  #
  # set attribute map (属性マップをセットする)
  # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
  # @return [Meteor::Element] element (要素)
  #
  def attr_map=(attr_map)
    @parser.attr_map(self, attr_map)
  end

  #
  # @overload content(content,entity_ref=true)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content(content)
  #  set content of element (要素の内容をセットする)
  #  @param [String] content content of element (要素の内容)
  #  @return [Meteor::Element] element (要素)
  #  @deprecated
  # @overload content()
  #  get content of element (要素の内容を取得する)
  #  @return [String] content (内容)
  #
  def content(*args)
    @parser.content(self, *args)
  end

  alias_method :text, :content

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def content=(value)
    @parser.content(self, value)
  end

  alias_method :text=, :content=

  #
  # set content of element (要素の内容をセットする)
  # @param [String] value content (要素の内容)
  # @return [Meteor::Element] element (要素)
  #
  def unsafe_content=(value)
    @parser.content(self, value, false)
  end

  alias_method :unsafe_text=, :unsafe_content=

  #
  # set attribute (属性をセットする)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @param [String] value attribute value (属性の値)
  # @return [Meteor::Element] element (要素)
  #
  def []=(name, value)
    if value != nil
      @parser.attr(self, name, value)
    else
      @parser.remove_attr(self, name)
    end
  end

  #
  # get attribute value (属性の値を取得する)
  # @param [String,Symbol] name attribute name (属性の名前)
  # @return [String] attribute value (属性の値)
  #
  def [](name)
    @parser.attr(self, name)
  end

  #
  # remove attribute of element (要素の属性を消す)
  # @param [String,Symbol] attr_name attribute name (属性名)
  # @return [Meteor::Element] element (要素)
  #
  def remove_attr(attr_name)
    @parser.remove_attr(self, attr_name)
  end

  #
  # remove element (要素を削除する)
  #
  def remove
    @parser.remove_element(self)
  end

  #
  # reflect (反映する)
  #
  def flash
    @parser.flash
  end

  alias_method :flush, :flash

  #
  # @overload execute(hook)
  #  run action of Hooker (Hookerクラスの処理を実行する)
  #  @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
  # @overload execute(loop,list)
  #  run action of Looper (Looperクラスの処理を実行する)
  #  @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
  #  @param [Array] list 配列
  #
  def execute(*args)
    @parser.execute(self, *args)
  end
end

Instance Method Details

#[](name) ⇒ String

get attribute value (属性の値を取得する)

Parameters:

  • name (String, Symbol)

    attribute name (属性の名前)

Returns:

  • (String)

    attribute value (属性の値)



528
529
530
# File 'lib/meteor/element.rb', line 528

def [](name)
  @parser.attr(self, name)
end

#[]=(name, value) ⇒ Meteor::Element

set attribute (属性をセットする)

Parameters:

  • name (String, Symbol)

    attribute name (属性の名前)

  • value (String)

    attribute value (属性の値)

Returns:



515
516
517
518
519
520
521
# File 'lib/meteor/element.rb', line 515

def []=(name, value)
  if value != nil
    @parser.attr(self, name, value)
  else
    @parser.remove_attr(self, name)
  end
end

#attr(attr) ⇒ Meteor::Element #attr(attr_name, attr_value) ⇒ Meteor::Element #attr(attr_name) ⇒ String

Overloads:

  • #attr(attr) ⇒ Meteor::Element
    Deprecated.

    set attribute of element (要素の属性をセットする)

    Parameters:

    • attr (Hash<String,String>, Hash<Symbol,String>)

      attribute (属性)

    Returns:

  • #attr(attr_name, attr_value) ⇒ Meteor::Element

    set attribute of element (要素の属性をセットする)

    Parameters:

    • attr_name (String, Symbol)

      attribute name (属性名)

    • attr_value (String, true, false)

      attribute value (属性値)

    Returns:

  • #attr(attr_name) ⇒ String

    get attribute value of element (要素の属性値を取得する)

    Parameters:

    • attr_name (String, Symbol)

      attribute name (属性名)

    Returns:

    • (String)

      attribute value (属性値)



413
414
415
# File 'lib/meteor/element.rb', line 413

def attr(attrs, *args)
  @parser.attr(self, attrs, *args)
end

#attr=(attr) ⇒ Meteor::Element

set attribute of element (要素の属性をセットする)

Parameters:

  • attr (Hash<String,String>, Hash<Symbol,String>)

    attribute (属性)

Returns:



422
423
424
# File 'lib/meteor/element.rb', line 422

def attr=(attr)
  @parser.attr(self, attr)
end

#attr_map(attr_map) ⇒ Meteor::Element #attr_mapMeteor::AttributeMap

Overloads:



452
453
454
# File 'lib/meteor/element.rb', line 452

def attr_map(*args)
  @parser.attr_map(self, *args)
end

#attr_map=(attr_map) ⇒ Meteor::Element

set attribute map (属性マップをセットする)

Parameters:

Returns:



461
462
463
# File 'lib/meteor/element.rb', line 461

def attr_map=(attr_map)
  @parser.attr_map(self, attr_map)
end

#attrsHash<String,String>, Hash<Symbol,String>

get attribute map (属性マップを取得する)

Returns:

  • (Hash<String,String>, Hash<Symbol,String>)

    attribute map (属性マップ)



438
439
440
# File 'lib/meteor/element.rb', line 438

def attrs
  @parser.attrs(self)
end

#attrs=(attrs) ⇒ Meteor::Element

set attribute map (要素マップをセットする)

Parameters:

  • attrs (Hash<String,String>, Hash<Symbol,String>)

    attribute map (属性マップ)

Returns:



430
431
432
# File 'lib/meteor/element.rb', line 430

def attrs=(attrs)
  @parser.attrs(self, attrs)
end

#cloneMeteor::Element #clone(ps) ⇒ Meteor::Element

clone (複製する)

Overloads:



160
161
162
163
164
165
166
167
# File 'lib/meteor/element.rb', line 160

def clone(*args)
  case args.length
  when Meteor::ZERO
    clone_0
  when Meteor::ONE
    clone_1(args[0])
  end
end

#content(content, entity_ref = true) ⇒ Meteor::Element #content(content) ⇒ Meteor::Element #contentString Also known as: text

Overloads:

  • #content(content, entity_ref = true) ⇒ Meteor::Element
    Deprecated.

    set content of element (要素の内容をセットする)

    Parameters:

    • content (String)

      content of element (要素の内容)

    • entity_ref (true, false) (defaults to: true)

      entity reference flag (エンティティ参照フラグ)

    Returns:

  • #content(content) ⇒ Meteor::Element
    Deprecated.

    set content of element (要素の内容をセットする)

    Parameters:

    • content (String)

      content of element (要素の内容)

    Returns:

  • #contentString

    get content of element (要素の内容を取得する)

    Returns:

    • (String)

      content (内容)



481
482
483
# File 'lib/meteor/element.rb', line 481

def content(*args)
  @parser.content(self, *args)
end

#content=(value) ⇒ Meteor::Element Also known as: text=

set content of element (要素の内容をセットする)

Parameters:

  • value (String)

    content (要素の内容)

Returns:



492
493
494
# File 'lib/meteor/element.rb', line 492

def content=(value)
  @parser.content(self, value)
end

#cxtag(name, id) ⇒ Meteor::Element #cxtag(id) ⇒ Meteor::Element

get cx(comment extension) tag (CX(コメント拡張)タグを取得する)

Overloads:

  • #cxtag(name, id) ⇒ Meteor::Element

    get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id=“ID属性値”)でCX(コメント拡張)タグを取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • id (String)

      id attribute value (ID属性値)

    Returns:

  • #cxtag(id) ⇒ Meteor::Element

    get cx(comment extension) tag using id attribute (ID属性(id=“ID属性値”)でCX(コメント拡張)タグを取得する)

    Parameters:

    • id (String)

      id attribute value (ID属性値)

    Returns:



393
394
395
# File 'lib/meteor/element.rb', line 393

def cxtag(*args)
  @parser.cxtag(*args)
end

#documentString

get document (ドキュメントを取得する)

Returns:

  • (String)

    document (ドキュメント)



226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
# File 'lib/meteor/element.rb', line 226

def document
  if @document_sync
    @document_sync = false
    case @parser.doc_type
    when Parser::HTML, Parser::HTML4
      if @cx
        # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
        @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
      else
        if @normal
          # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
          @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
        else
          @document = String.new("") << "<" << @name << @attributes << ">"
          # @document = "<#{@name}#{@attributes}>"
        end
      end
    when Parser::XHTML, Parser::XHTML4, Parser::XML
      if @cx
        # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
        @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
      else
        if @normal
          # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
          @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
        else
          @document = String.new("") << "<" << @name << @attributes << "/>"
          # @document = "<#{@name}#{@attributes}/>"
        end
      end
    end
  else
    @document
  end
end

#document=(doc) ⇒ Object

set document (ドキュメントをセットする)

Parameters:

  • doc (String)

    document (ドキュメント)



217
218
219
220
# File 'lib/meteor/element.rb', line 217

def document=(doc)
  @document_sync = false
  @document = doc
end

#elementMeteor::Element #element(name) ⇒ Meteor::Element #element(name, attrs) ⇒ Meteor::Element #element(attrs) ⇒ Meteor::Element #element(name, attr_name, attr_value) ⇒ Meteor::Element #element(attr_name, attr_value) ⇒ Meteor::Element #element(name, attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Meteor::Element #element(attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Meteor::Element #element(elm) ⇒ Meteor::Element Also known as: child

get element (要素を取得する)

Overloads:

  • #elementMeteor::Element

    get element (要素を取得する)

    Returns:

  • #element(name) ⇒ Meteor::Element

    get element using tag name (要素のタグ名で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    Returns:

  • #element(name, attrs) ⇒ Meteor::Element

    get element using tag name and attribute map (要素のタグ名と属性(属性名=“属性値”)あるいは属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attrs (Hash<String,String>, Hash<Symbol,String>)

      attribute map (属性マップ)

    Returns:

  • #element(attrs) ⇒ Meteor::Element

    get element using attribute map (属性(属性名=“属性値”)あるいは属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attrs (Hash<String,String>, Hash<Symbol,String>)

      attribute map (属性マップ)

    Returns:

  • #element(name, attr_name, attr_value) ⇒ Meteor::Element

    get element using tag name and attribute(name=“value”) (要素のタグ名と属性(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attr_name (String, Symbol)

      attribute name (属性名)

    • attr_value (String)

      attribute value (属性値)

    Returns:

  • #element(attr_name, attr_value) ⇒ Meteor::Element

    get element using attribute(name=“value”) (属性(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attr_name (String, Symbol)

      属性名

    • attr_value (String)

      属性値

    Returns:

  • #element(name, attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Meteor::Element

    get element using tag name and attribute1,2(name=“value”) (要素のタグ名と属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attr_name1 (String, Symbol)

      attribute name1 (属性名1)

    • attr_value1 (String)

      attribute value1 (属性値1)

    • attr_name2 (String, Symbol)

      attribute name2 (属性名2)

    • attr_value2 (String)

      attribute value2 (属性値2)

    Returns:

  • #element(attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Meteor::Element

    get element using attribute1,2(name=“value”) (属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attr_name1 (String, Symbol)

      属性名1

    • attr_value1 (String)

      属性値1

    • attr_name2 (String, Symbol)

      属性名2

    • attr_value2 (String)

      属性値2

    Returns:

  • #element(elm) ⇒ Meteor::Element

    mirror element (要素を射影する)

    Parameters:

    Returns:



311
312
313
314
315
316
317
318
319
# File 'lib/meteor/element.rb', line 311

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

#elements(name) ⇒ Array<Meteor::Element> #elements(name, attrs) ⇒ Array<Meteor::Element> #elements(attrs) ⇒ Array<Meteor::Element> #elements(name, attr_name, attr_value) ⇒ Array<Meteor::Element> #elements(attr_name, attr_value) ⇒ Array<Meteor::Element> #elements(name, attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Array<Meteor::Element> #elements(attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Array<Meteor::Element>

get elements (要素を取得する)

Overloads:

  • #elements(name) ⇒ Array<Meteor::Element>

    get elements using tag name (要素のタグ名で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    Returns:

  • #elements(name, attrs) ⇒ Array<Meteor::Element>

    get elements using tag name and attribute map (要素のタグ名と属性(属性名=“属性値”)あるいは属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attrs (Hash<String,String>, Hash<Symbol,String>)

      attribute map (属性マップ)

    Returns:

  • #elements(attrs) ⇒ Array<Meteor::Element>

    get elements using attribute map (属性(属性名=“属性値”)あるいは属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attrs (Hash<String,String>, Hash<Symbol,String>)

      attribute map (属性マップ)

    Returns:

  • #elements(name, attr_name, attr_value) ⇒ Array<Meteor::Element>

    get elements using tag name and attribute(name=“value”) (要素のタグ名と属性(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attr_name (String, Symbol)

      attribute name (属性名)

    • attr_value (String)

      attribute value (属性値)

    Returns:

  • #elements(attr_name, attr_value) ⇒ Array<Meteor::Element>

    get elements using attribute(name=“value”) (属性(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attr_name (String, Symbol)

      attribute name (属性名)

    • attr_value (String)

      attribute value (属性値)

    Returns:

  • #elements(name, attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Array<Meteor::Element>

    get elements using tag name and attribute1,2(name=“value”) (要素のタグ名と属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • name (String, Symbol)

      tag name (タグ名)

    • attr_name1 (String, Symbol)

      attribute name1 (属性名1)

    • attr_value1 (String)

      attribute value1 (属性値1)

    • attr_name2 (String, Symbol)

      attribute name2 (属性名2)

    • attr_value2 (String)

      attribute value2 (属性値2)

    Returns:

  • #elements(attr_name1, attr_value1, attr_name2, attr_value2) ⇒ Array<Meteor::Element>

    get elements using attribute1,2(name=“value”) (属性1・属性2(属性名=“属性値”)で要素を取得する)

    Parameters:

    • attr_name1 (String, Symbol)

      attribute name1 (属性名1)

    • attr_value1 (String)

      attribute value1 (属性値1)

    • attr_name2 (String, Symbol)

      attribute name2 (属性名2)

    • attr_value2 (String)

      attribute value2 (属性値2)

    Returns:



365
366
367
# File 'lib/meteor/element.rb', line 365

def elements(*args)
  @parser.elements(*args)
end

#execute(hook) ⇒ Object #execute(loop, list) ⇒ Object

Overloads:

  • #execute(hook) ⇒ Object

    run action of Hooker (Hookerクラスの処理を実行する)

    Parameters:

    • hook (Meteor::Hook::Hooker)

      Hooker object (Hookerオブジェクト)

  • #execute(loop, list) ⇒ Object

    run action of Looper (Looperクラスの処理を実行する)

    Parameters:

    • loop (Meteor::Hook::Looper)

      Looper object (Looperオブジェクト)

    • list (Array)

      配列



566
567
568
# File 'lib/meteor/element.rb', line 566

def execute(*args)
  @parser.execute(self, *args)
end

#find(selector) ⇒ Array<Meteor::Element> Also known as: css

get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する) CSS3 selector partial support (CSS3セレクタの部分的サポート)

Parameters:

  • selector (String)

    selector (セレクタ)

Returns:



375
376
377
# File 'lib/meteor/element.rb', line 375

def find(selector)
  @parser.find(selector)
end

#flashObject Also known as: flush

reflect (反映する)



551
552
553
# File 'lib/meteor/element.rb', line 551

def flash
  @parser.flash
end

#removeObject

remove element (要素を削除する)



544
545
546
# File 'lib/meteor/element.rb', line 544

def remove
  @parser.remove_element(self)
end

#remove_attr(attr_name) ⇒ Meteor::Element

remove attribute of element (要素の属性を消す)

Parameters:

  • attr_name (String, Symbol)

    attribute name (属性名)

Returns:



537
538
539
# File 'lib/meteor/element.rb', line 537

def remove_attr(attr_name)
  @parser.remove_attr(self, attr_name)
end

#unsafe_content=(value) ⇒ Meteor::Element Also known as: unsafe_text=

set content of element (要素の内容をセットする)

Parameters:

  • value (String)

    content (要素の内容)

Returns:



503
504
505
# File 'lib/meteor/element.rb', line 503

def unsafe_content=(value)
  @parser.content(self, value, false)
end