meteor 0.9.12 → 0.9.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,108 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ module Core
6
+ module Util
7
+ #
8
+ # Pattern Cache Class (パターン・キャッシュ クラス)
9
+ #
10
+ class PatternCache
11
+ @@regex_cache = Hash.new
12
+
13
+ ##
14
+ ## intializer (イニシャライザ)
15
+ ##
16
+ # def initialize
17
+ # end
18
+
19
+ #
20
+ # get pattern (パターンを取得する)
21
+ # @overload get(regex)
22
+ # @param [String] regex regular expression (正規表現)
23
+ # @return [Regexp] pattern (パターン)
24
+ # @overload get(regex,option)
25
+ # @param [String] regex regular expression (正規表現)
26
+ # @param [Fixnum] option option of Regex (オプション)
27
+ # @return [Regexp] pattern (パターン)
28
+ #
29
+ def self.get(*args)
30
+ case args.length
31
+ when ONE
32
+ # get_1(args[0])
33
+ if @@regex_cache[args[0].to_sym]
34
+ @@regex_cache[args[0].to_sym]
35
+ else
36
+ @@regex_cache[args[0].to_sym] = Regexp.new(args[0], Regexp::MULTILINE)
37
+ end
38
+
39
+ when TWO
40
+ # get_2(args[0], args[1])
41
+ if @@regex_cache[args[0].to_sym]
42
+ @@regex_cache[args[0].to_sym]
43
+ else
44
+ @@regex_cache[args[0].to_sym] = Regexp.new(args[0], args[1])
45
+ end
46
+ else
47
+ raise ArgumentError
48
+ end
49
+ end
50
+
51
+ ##
52
+ ## get pattern (パターンを取得する)
53
+ ## @param [String] regex regular expression (正規表現)
54
+ ## @return [Regexp] pattern (パターン)
55
+ ##
56
+ # def self.get_1(regex)
57
+ # ## pattern = @@regex_cache[regex]
58
+ # ##
59
+ # ## if pattern == nil
60
+ # # if regex.kind_of?(String)
61
+ # if !@@regex_cache[regex.to_sym]
62
+ # # pattern = Regexp.new(regex)
63
+ # # @@regex_cache[regex] = pattern
64
+ # @@regex_cache[regex.to_sym] = Regexp.new(regex, Regexp::MULTILINE)
65
+ # end
66
+ #
67
+ # # return pattern
68
+ # @@regex_cache[regex.to_sym]
69
+ # ## elsif regex.kind_of?(Symbol)
70
+ # ## if !@@regex_cache[regex]
71
+ # ## @@regex_cache[regex.object_id] = Regexp.new(regex.to_s, Regexp::MULTILINE)
72
+ # ## end
73
+ # ##
74
+ # ## @@regex_cache[regex]
75
+ # # end
76
+ # end
77
+
78
+ ##
79
+ ## パターンを取得する
80
+ ## @param [String] regex 正規表現
81
+ ## @param [Fixnum] option オプション
82
+ ## @return [Regexp] パターン
83
+ ##
84
+ # def self.get_2(regex, option)
85
+ # ## pattern = @@regex_cache[regex]
86
+ # ##
87
+ # ## if pattern == nil
88
+ # # if regex.kind_of?(String)
89
+ # if !@@regex_cache[regex.to_sym]
90
+ # # pattern = Regexp.new(regex)
91
+ # # @@regex_cache[regex] = pattern
92
+ # @@regex_cache[regex.to_sym] = Regexp.new(regex, option,"UTF-8")
93
+ # end
94
+ #
95
+ # # return pattern
96
+ # @@regex_cache[regex.to_sym]
97
+ # ## elsif regex.kind_of?(Symbol)
98
+ # ## if !@@regex_cache[regex]
99
+ # ## @@regex_cache[regex] = Regexp.new(regex.to_s, option,"UTF-8")
100
+ # ## end
101
+ # ##
102
+ # ## @@regex_cache[regex]
103
+ # # end
104
+ # end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,534 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ #
6
+ # Element Class (要素クラス)
7
+ #
8
+ # @!attribute [rw] name
9
+ # @return [String] tag name (要素名)
10
+ # @!attribute [rw] attributes
11
+ # @return [String] attributes (属性群)
12
+ # @!attribute [rw] mixed_content
13
+ # @return [String] content (内容)
14
+ # @!attribute [rw] raw_content
15
+ # @return [false,true] entity ref flag of content (内容のエンティティ参照フラグ)
16
+ # @!attribute [rw] pattern
17
+ # @return [String] pattern (パターン)
18
+ # @!attribute [rw] document_sync
19
+ # @return [true,false] document update flag (ドキュメント更新フラグ)
20
+ # @!attribute [rw] empty
21
+ # @return [true,false] content empty flag (内容存在フラグ)
22
+ # @!attribute [rw] cx
23
+ # @return [true,false] comment extension tag flag (コメント拡張タグフラグ)
24
+ # @!attribute [rw] mono
25
+ # @return [true,false] child element existance flag (子要素存在フラグ)
26
+ # @!attribute [rw] parser
27
+ # @return [Meteor::Parser] parser(パーサ)
28
+ # @!attribute [rw] type_value
29
+ # @return [String] type (タイプ属性)
30
+ # @!attribute [rw] usable
31
+ # @return [true,false] usable flag (有効・無効フラグ)
32
+ # @!attribute [rw] origin
33
+ # @return [Meteor::Element] original pointer (原本ポインタ)
34
+ # @!attribute [rw] copy
35
+ # @return [Meteor::Element] copy pointer (複製ポインタ)
36
+ # @!attribute [rw] removed
37
+ # @return [true,false] deletion flag (削除フラグ)
38
+ #
39
+ class Element
40
+ attr_accessor :name
41
+ attr_accessor :attributes
42
+ attr_accessor :mixed_content
43
+ attr_accessor :raw_content
44
+ attr_accessor :pattern
45
+ attr_accessor :document_sync
46
+ attr_accessor :empty
47
+ attr_accessor :cx
48
+ attr_accessor :mono
49
+ attr_accessor :parser
50
+ attr_accessor :type_value
51
+ attr_accessor :usable
52
+ attr_accessor :origin
53
+ attr_accessor :copy
54
+ attr_accessor :removed
55
+
56
+ alias :tag :name
57
+ alias :tag= :name=
58
+
59
+ #
60
+ # initializer (イニシャライザ)
61
+ # @overload initialize(name)
62
+ # @param [String,Symbol] name tag name (タグ名)
63
+ # @overload initialize(elm)
64
+ # @param [Meteor::Element] elm element (要素)
65
+ # @overload initialize(elm,ps)
66
+ # @param [Meteor::Element] elm element (要素)
67
+ # @param [Meteor::Parser] ps parser (パーサ)
68
+ #
69
+ def initialize(*args)
70
+ case args.length
71
+ when Meteor::ONE
72
+ if args[0].kind_of?(String)
73
+ initialize_s(args[0])
74
+ elsif args[0].kind_of?(Meteor::Element)
75
+ initialize_e(args[0])
76
+ else
77
+ raise ArgumentError
78
+ end
79
+
80
+ when Meteor::TWO
81
+ @name = args[0].name
82
+ @attributes = String.new(args[0].attributes)
83
+ @mixed_content = String.new(args[0].mixed_content)
84
+ # @pattern = String.new(args[0].pattern)
85
+ @pattern = args[0].pattern
86
+ @document = String.new(args[0].document)
87
+ @empty = args[0].empty
88
+ @cx = args[0].cx
89
+ @mono = args[0].mono
90
+ @parser = args[1]
91
+ # @usable = false
92
+ @origin = args[0]
93
+ args[0].copy = self
94
+ when Meteor::ZERO
95
+ else
96
+ raise ArgumentError
97
+ end
98
+ end
99
+
100
+ #
101
+ # initializer (イニシャライザ)
102
+ # @param [String] name tag name (タグ名)
103
+ #
104
+ def initialize_s(name)
105
+ @name = name
106
+ # @attributes = nil
107
+ # @mixed_content = nil
108
+ # @pattern = nil
109
+ # @document = nil
110
+ # @parser=nil
111
+ # @empty = false
112
+ # @cx = false
113
+ # @mono = false
114
+ # @parent = false
115
+ @usable = true
116
+ end
117
+
118
+ private :initialize_s
119
+
120
+ #
121
+ # initializer (イニシャライザ)
122
+ # @param [Meteor::Element] elm element (要素)
123
+ #
124
+ def initialize_e(elm)
125
+ @name = elm.name
126
+ @attributes = String.new(elm.attributes)
127
+ # @pattern = String.new(elm.pattern)
128
+ @pattern = elm.pattern
129
+ @document = String.new(elm.document)
130
+ @empty = elm.empty
131
+ @cx = elm.cx
132
+ @mono = elm.mono
133
+ @origin = elm
134
+ @parser = elm.parser
135
+ @usable = true
136
+ end
137
+
138
+ private :initialize_e
139
+
140
+ #
141
+ # make copy (コピーを作成する)
142
+ # @overload new!(elm,ps)
143
+ # @param [Meteor::Element] elm element (要素)
144
+ # @param [Meteor::Parser] ps parser (パーサ)
145
+ # @return [Meteor::Element] element (要素)
146
+ #
147
+ def self.new!(*args)
148
+ case args.length
149
+ when Meteor::TWO
150
+ @obj = args[1].element_hook
151
+ if @obj
152
+ @obj.attributes = String.new(args[0].attributes)
153
+ @obj.mixed_content = String.new(args[0].mixed_content)
154
+ # @obj.pattern = String.new(args[0].pattern)
155
+ @obj.document = String.new(args[0].document)
156
+ @obj
157
+ else
158
+ @obj = self.new(args[0], args[1])
159
+ args[1].element_hook = @obj
160
+ @obj
161
+ end
162
+ else
163
+ raise ArgumentError
164
+ end
165
+ end
166
+
167
+ #
168
+ # clone (複製する)
169
+ # @return [Meteor::Element] element (要素)
170
+ #
171
+ def clone
172
+ obj = self.parser.element_cache[self.object_id]
173
+ if obj
174
+ obj.attributes = String.new(self.attributes)
175
+ obj.mixed_content = String.new(self.mixed_content)
176
+ # obj.pattern = String.new(self.pattern)
177
+ obj.document = String.new(self.document)
178
+ obj.usable = true
179
+ obj
180
+ else
181
+ obj = self.new(self)
182
+ self.parser.element_cache[self.object_id] = obj
183
+ obj
184
+ end
185
+ end
186
+
187
+ #
188
+ # set document (ドキュメントをセットする)
189
+ # @param [String] doc document (ドキュメント)
190
+ #
191
+ def document=(doc)
192
+ @document_sync = false
193
+ @document = doc
194
+ end
195
+
196
+ #
197
+ # get document (ドキュメントを取得する)
198
+ # @return [String] document (ドキュメント)
199
+ #
200
+ def document
201
+ if @document_sync
202
+ @document_sync = false
203
+ case @parser.doc_type
204
+ when Parser::HTML, Parser::HTML4
205
+ if @cx
206
+ # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
207
+ @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
208
+ else
209
+ if @empty
210
+ # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
211
+ @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
212
+ else
213
+ @document = String.new("") << "<" << @name << @attributes << ">"
214
+ # @document = "<#{@name}#{@attributes}>"
215
+ end
216
+ end
217
+
218
+ when Parser::XHTML, Parser::XHTML4, Parser::XML
219
+ if @cx
220
+ # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->' << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
221
+ @document = "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
222
+ else
223
+ if @empty
224
+ # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content << '</' << elm.name << '>'
225
+ @document = "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
226
+ else
227
+ @document = String.new("") << "<" << @name << @attributes << "/>"
228
+ # @document = "<#{@name}#{@attributes}/>"
229
+ end
230
+ end
231
+ end
232
+ else
233
+ @document
234
+ end
235
+ end
236
+
237
+ #
238
+ # get element (要素を取得する)
239
+ # @overload element()
240
+ # get element (要素を取得する)
241
+ # @return [Meteor::Element] element (要素)
242
+ # @overload element(name)
243
+ # get element using tag name (要素のタグ名で要素を取得する)
244
+ # @param [String,Symbol] name tag name (タグ名)
245
+ # @return [Meteor::Element] element (要素)
246
+ # @overload element(name,attrs)
247
+ # get element using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
248
+ # @param [String,Symbol] name tag name (タグ名)
249
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
250
+ # @return [Meteor::Element] element (要素)
251
+ # @overload element(attrs)
252
+ # get element using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
253
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
254
+ # @return [Meteor::Element] element(要素)
255
+ # @overload element(name,attr_name,attr_value)
256
+ # get element using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
257
+ # @param [String,Symbol] name tag name (タグ名)
258
+ # @param [String,Symbol] attr_name attribute name (属性名)
259
+ # @param [String] attr_value attribute value (属性値)
260
+ # @return [Meteor::Element] element (要素)
261
+ # @overload element(attr_name,attr_value)
262
+ # get element using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
263
+ # @param [String,Symbol] attr_name 属性名
264
+ # @param [String] attr_value 属性値
265
+ # @return [Meteor::Element] element (要素)
266
+ # @overload element(name,attr_name1,attr_value1,attr_name2,attr_value2)
267
+ # get element using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
268
+ # @param [String,Symbol] name tag name (タグ名)
269
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
270
+ # @param [String] attr_value1 attribute value1 (属性値1)
271
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
272
+ # @param [String] attr_value2 attribute value2 (属性値2)
273
+ # @return [Meteor::Element] element (要素)
274
+ # @overload element(attr_name1,attr_value1,attr_name2,attr_value2)
275
+ # get element using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
276
+ # @param [String,Symbol] attr_name1 属性名1
277
+ # @param [String] attr_value1 属性値1
278
+ # @param [String,Symbol] attr_name2 属性名2
279
+ # @param [String] attr_value2 属性値2
280
+ # @return [Meteor::Element] element(要素)
281
+ # @overload element(elm)
282
+ # mirror element (要素を射影する)
283
+ # @param [Meteor::Element] elm element(要素)
284
+ # @return [Meteor::Element] element(要素)
285
+ #
286
+ def element(elm = nil, attrs = nil, *args)
287
+ # case args.length
288
+ # when ZERO
289
+ if !elm && !attrs
290
+ @parser.element(self)
291
+ else
292
+ @parser.element(elm, attrs, *args)
293
+ end
294
+ end
295
+
296
+ alias :child :element
297
+
298
+ #
299
+ # get elements (要素を取得する)
300
+ # @overload elements(name)
301
+ # get elements using tag name (要素のタグ名で要素を取得する)
302
+ # @param [String,Symbol] name tag name (タグ名)
303
+ # @return [Array<Meteor::Element>] element array(要素配列)
304
+ # @overload elements(name,attrs)
305
+ # get elements using tag name and attribute map (要素のタグ名と属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
306
+ # @param [String,Symbol] name tag name (タグ名)
307
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
308
+ # @return [Array<Meteor::Element>] element array (要素配列)
309
+ # @overload elements(attrs)
310
+ # get elements using attribute map (属性(属性名="属性値")あるいは属性1・属性2(属性名="属性値")で要素を取得する)
311
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
312
+ # @return [Array<Meteor::Element>] element array (要素配列)
313
+ # @overload elements(name,attr_name,attr_value)
314
+ # get elements using tag name and attribute(name="value") (要素のタグ名と属性(属性名="属性値")で要素を取得する)
315
+ # @param [String,Symbol] name tag name (タグ名)
316
+ # @param [String,Symbol] attr_name attribute name (属性名)
317
+ # @param [String] attr_value attribute value (属性値)
318
+ # @return [Array<Meteor::Element>] element array (要素配列)
319
+ # @overload elements(attr_name,attr_value)
320
+ # get elements using attribute(name="value") (属性(属性名="属性値")で要素を取得する)
321
+ # @param [String,Symbol] attr_name attribute name (属性名)
322
+ # @param [String] attr_value attribute value (属性値)
323
+ # @return [Array<Meteor::Element>] element array (要素配列)
324
+ # @overload elements(name,attr_name1,attr_value1,attr_name2,attr_value2)
325
+ # get elements using tag name and attribute1,2(name="value") (要素のタグ名と属性1・属性2(属性名="属性値")で要素を取得する)
326
+ # @param [String,Symbol] name tag name (タグ名)
327
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
328
+ # @param [String] attr_value1 attribute value1 (属性値1)
329
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
330
+ # @param [String] attr_value2 attribute value2 (属性値2)
331
+ # @return [Array<Meteor::Element>] element array (要素配列)
332
+ # @overload elements(attr_name1,attr_value1,attr_name2,attr_value2)
333
+ # get elements using attribute1,2(name="value") (属性1・属性2(属性名="属性値")で要素を取得する)
334
+ # @param [String,Symbol] attr_name1 attribute name1 (属性名1)
335
+ # @param [String] attr_value1 attribute value1 (属性値1)
336
+ # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
337
+ # @param [String] attr_value2 attribute value2 (属性値2)
338
+ # @return [Array<Meteor::Element>] element array (要素配列)
339
+ #
340
+ def elements(*args)
341
+ @parser.elements(*args)
342
+ end
343
+
344
+ #
345
+ # get (child) elements using selector like css3(CSS3のようにセレクタを用いて(子)要素を取得する)
346
+ # CSS3 selector partial support (CSS3セレクタの部分的サポート)
347
+ # @param selector [String] selector (セレクタ)
348
+ # @return [Array<Meteor::Element>] element (要素)
349
+ #
350
+ def find(selector)
351
+ @parser.find(selector)
352
+ end
353
+
354
+ alias :css :find
355
+
356
+ #
357
+ # get cx(comment extension) tag (CX(コメント拡張)タグを取得する)
358
+ # @overload cxtag(name,id)
359
+ # get cx(comment extension) tag using tag name and id attribute (タグ名とID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
360
+ # @param [String,Symbol] name tag name (タグ名)
361
+ # @param [String] id id attribute value (ID属性値)
362
+ # @return [Meteor::Element] element(要素)
363
+ # @overload cxtag(id)
364
+ # get cx(comment extension) tag using id attribute (ID属性(id="ID属性値")でCX(コメント拡張)タグを取得する)
365
+ # @param [String] id id attribute value (ID属性値)
366
+ # @return [Meteor::Element] element (要素)
367
+ #
368
+ def cxtag(*args)
369
+ @parser.cxtag(*args)
370
+ end
371
+
372
+ #
373
+ # @overload attr(attr)
374
+ # set attribute of element (要素の属性をセットする)
375
+ # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
376
+ # @return [Meteor::Element] element (要素)
377
+ # @deprecated
378
+ # @overload attr(attr_name,attr_value)
379
+ # set attribute of element (要素の属性をセットする)
380
+ # @param [String,Symbol] attr_name attribute name (属性名)
381
+ # @param [String,true,false] attr_value attribute value (属性値)
382
+ # @return [Meteor::Element] element (要素)
383
+ # @overload attr(attr_name)
384
+ # get attribute value of element (要素の属性値を取得する)
385
+ # @param [String,Symbol] attr_name attribute name (属性名)
386
+ # @return [String] attribute value (属性値)
387
+ #
388
+ def attr(attrs, *args)
389
+ @parser.attr(self, attrs, *args)
390
+ end
391
+
392
+ #
393
+ # set attribute of element (要素の属性をセットする)
394
+ # @param [Hash<String,String>,Hash<Symbol,String>] attr attribute (属性)
395
+ # @return [Meteor::Element] element (要素)
396
+ #
397
+ def attr=(attr)
398
+ @parser.attr(self, attr)
399
+ end
400
+
401
+ #
402
+ # set attribute map (要素マップをセットする)
403
+ # @param [Hash<String,String>,Hash<Symbol,String>] attrs attribute map (属性マップ)
404
+ # @return [Meteor::Element] element (要素)
405
+ def attrs=(attrs)
406
+ @parser.attrs(self, attrs)
407
+ end
408
+
409
+ #
410
+ # get attribute map (属性マップを取得する)
411
+ # @return [Hash<String,String>,Hash<Symbol,String>] attribute map (属性マップ)
412
+ #
413
+ def attrs
414
+ @parser.attrs(self)
415
+ end
416
+
417
+ #
418
+ # @overload attr_map(attr_map)
419
+ # set attribute map (属性マップをセットする)
420
+ # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
421
+ # @return [Meteor::Element] element (要素)
422
+ # @deprecated
423
+ # @overload attr_map()
424
+ # get attribute map (属性マップを取得する)
425
+ # @return [Meteor::AttributeMap] attribute map (属性マップ)
426
+ #
427
+ def attr_map(*args)
428
+ @parser.attr_map(self, *args)
429
+ end
430
+
431
+ #
432
+ # set attribute map (属性マップをセットする)
433
+ # @param [Meteor::AttributeMap] attr_map attribute map (属性マップ)
434
+ # @return [Meteor::Element] element (要素)
435
+ #
436
+ def attr_map=(attr_map)
437
+ @parser.attr_map(self, attr_map)
438
+ end
439
+
440
+ #
441
+ # @overload content(content,entity_ref=true)
442
+ # set content of element (要素の内容をセットする)
443
+ # @param [String] content content of element (要素の内容)
444
+ # @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
445
+ # @return [Meteor::Element] element (要素)
446
+ # @deprecated
447
+ # @overload content(content)
448
+ # set content of element (要素の内容をセットする)
449
+ # @param [String] content content of element (要素の内容)
450
+ # @return [Meteor::Element] element (要素)
451
+ # @deprecated
452
+ # @overload content()
453
+ # get content of element (要素の内容を取得する)
454
+ # @return [String] content (内容)
455
+ #
456
+ def content(*args)
457
+ @parser.content(self, *args)
458
+ end
459
+
460
+ alias :text :content
461
+
462
+ #
463
+ # set content of element (要素の内容をセットする)
464
+ # @param [String] value content (要素の内容)
465
+ # @return [Meteor::Element] element (要素)
466
+ #
467
+ def content=(value)
468
+ @parser.content(self, value)
469
+ end
470
+
471
+ alias :text= :content=
472
+
473
+ #
474
+ # set attribute (属性をセットする)
475
+ # @param [String,Symbol] name attribute name (属性の名前)
476
+ # @param [String] value attribute value (属性の値)
477
+ # @return [Meteor::Element] element (要素)
478
+ #
479
+ def []=(name, value)
480
+ if value != nil
481
+ @parser.attr(self, name, value)
482
+ else
483
+ @parser.remove_attr(self, name)
484
+ end
485
+ end
486
+
487
+ #
488
+ # get attribute value (属性の値を取得する)
489
+ # @param [String,Symbol] name attribute name (属性の名前)
490
+ # @return [String] attribute value (属性の値)
491
+ #
492
+ def [](name)
493
+ @parser.attr(self, name)
494
+ end
495
+
496
+ #
497
+ # remove attribute of element (要素の属性を消す)
498
+ # @param [String,Symbol] attr_name attribute name (属性名)
499
+ # @return [Meteor::Element] element (要素)
500
+ #
501
+ def remove_attr(attr_name)
502
+ @parser.remove_attr(self, attr_name)
503
+ end
504
+
505
+ #
506
+ # remove element (要素を削除する)
507
+ #
508
+ def remove
509
+ @parser.remove_element(self)
510
+ end
511
+
512
+ #
513
+ # reflect (反映する)
514
+ #
515
+ def flash
516
+ @parser.flash
517
+ end
518
+
519
+ alias :flush :flash
520
+
521
+ #
522
+ # @overload execute(hook)
523
+ # run action of Hooker (Hookerクラスの処理を実行する)
524
+ # @param [Meteor::Hook::Hooker] hook Hooker object (Hookerオブジェクト)
525
+ # @overload execute(loop,list)
526
+ # run action of Looper (Looperクラスの処理を実行する)
527
+ # @param [Meteor::Hook::Looper] loop Looper object (Looperオブジェクト)
528
+ # @param [Array] list 配列
529
+ #
530
+ def execute(*args)
531
+ @parser.execute(self, *args)
532
+ end
533
+ end
534
+ end