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,170 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ module Ml
6
+ module Xml
7
+ #
8
+ # XML parser (XMLパーサ)
9
+ #
10
+ class ParserImpl < Meteor::Core::Kernel
11
+ # KAIGYO_CODE = "\r?\n|\r"
12
+ KAIGYO_CODE = ["\r\n", "\n", "\r"]
13
+
14
+ PATTERN_UNESCAPE = "&(amp|quot|apos|gt|lt);"
15
+
16
+ @@pattern_unescape = Regexp.new(PATTERN_UNESCAPE)
17
+
18
+ TABLE_FOR_ESCAPE_ = {
19
+ "&" => "&amp;",
20
+ "\"" => "&quot;",
21
+ "'" => "&apos;",
22
+ "<" => "&lt;",
23
+ ">" => "&gt;"
24
+ }
25
+ PATTERN_ESCAPE = "[&\\\"'<>]"
26
+ @@pattern_escape = Regexp.new(PATTERN_ESCAPE)
27
+
28
+ #
29
+ # initializer (イニシャライザ)
30
+ # @overload initialize
31
+ # @overload initialize(ps)
32
+ # @param [Meteor::Parser] ps parser (パーサ)
33
+ #
34
+ def initialize(*args)
35
+ super()
36
+ @doc_type = Parser::XML
37
+ case args.length
38
+ when ZERO
39
+ # initialize_0
40
+ when ONE
41
+ initialize_1(args[0])
42
+ else
43
+ raise ArgumentError
44
+ end
45
+ end
46
+
47
+ #
48
+ # initializer (イニシャライザ)
49
+ #
50
+ # def initialize_0
51
+ # end
52
+ #
53
+ # private :initialize_0
54
+ #
55
+ # private :initialize_0
56
+
57
+ #
58
+ # initializer (イニシャライザ)
59
+ # @param [Meteor::Parser] ps parser (パーサ)
60
+ #
61
+ def initialize_1(ps)
62
+ @root.document = String.new(ps.document)
63
+ ps.document_hook = String.new(ps.document_hook)
64
+ @root.content_type = String.new(ps.root_element.content_type)
65
+ @root.kaigyo_code = ps.root_element.kaigyo_code
66
+ end
67
+
68
+ private :initialize_1
69
+
70
+ #
71
+ # parse document (ドキュメントを解析する)
72
+ #
73
+ def parse
74
+ analyze_ml
75
+ end
76
+
77
+ #
78
+ # analyze document (ドキュメントをパースする)
79
+ #
80
+ def analyze_ml
81
+ analyze_kaigyo_code
82
+ analyze_content_type
83
+
84
+ @res = nil
85
+ end
86
+
87
+ private :analyze_ml
88
+
89
+ #
90
+ # get content type (コンテントタイプを取得する)
91
+ # @return [String] conent type (コンテントタイプ)
92
+ #
93
+ def content_type
94
+ @root.content_type
95
+ end
96
+
97
+ #
98
+ # analuze document , set newline (ドキュメントをパースし、改行コードをセットする)
99
+ #
100
+ def analyze_kaigyo_code
101
+ for a in KAIGYO_CODE
102
+ if @root.document.include?(a)
103
+ @root.kaigyo_code = a
104
+ # puts "kaigyo:" << @root.kaigyo_code
105
+ end
106
+ end
107
+ end
108
+
109
+ private :analyze_kaigyo_code
110
+
111
+ #
112
+ # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
113
+ #
114
+ def analyze_content_type
115
+ @root.content_type = "text/xml"
116
+ end
117
+
118
+ private :analyze_content_type
119
+
120
+ def escape(content)
121
+ # replace special character (特殊文字の置換)
122
+ content = content.gsub(@@pattern_escape, TABLE_FOR_ESCAPE_)
123
+
124
+ content
125
+ end
126
+
127
+ private :escape
128
+
129
+ def escape_content(*args)
130
+ escape(args[0])
131
+ end
132
+
133
+ private :escape_content
134
+
135
+ def unescape(content)
136
+ # replace special character (特殊文字の置換)
137
+ # 「<」<-「&lt;」
138
+ # 「>」<-「&gt;」
139
+ # 「"」<-「&quot;」
140
+ # 「'」<-「&apos;」
141
+ # 「&」<-「&amp;」
142
+ content.gsub(@@pattern_unescape) do
143
+ case $1
144
+ when "amp"
145
+ "&"
146
+ when "quot"
147
+ "\""
148
+ when "apos"
149
+ "'"
150
+ when "gt"
151
+ ">"
152
+ when "lt"
153
+ "<"
154
+ end
155
+ end
156
+
157
+ content
158
+ end
159
+
160
+ private :unescape
161
+
162
+ def unescape_content(*args)
163
+ unescape(args[0])
164
+ end
165
+
166
+ private :unescape_content
167
+ end
168
+ end
169
+ end
170
+ end
@@ -0,0 +1,15 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ #
6
+ # Parser Class (パーサ共通クラス)
7
+ #
8
+ class Parser
9
+ HTML = 0
10
+ XHTML = 1
11
+ HTML4 = 2
12
+ XHTML4 = 3
13
+ XML = 4
14
+ end
15
+ end
@@ -0,0 +1,493 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ #
6
+ # Parser Factory Class (パーサ・ファクトリ クラス)
7
+ #
8
+ # @!attribute [rw] type
9
+ # @return [FixNum,Symbol] default type of parser (デフォルトのパーサ・タイプ)
10
+ # @!attribute [rw] root
11
+ # @return [String] root root directory (基準ディレクトリ)
12
+ # @!attribute [rw] enc
13
+ # @return [String] default character encoding (デフォルトエンコーディング)
14
+ #
15
+ class ParserFactory
16
+ attr_accessor :type
17
+ attr_accessor :root
18
+ attr_accessor :enc
19
+
20
+ alias_method :base_type, :type
21
+ alias_method :base_type=, :type=
22
+ alias_method :base_dir, :root
23
+ alias_method :base_dir=, :root=
24
+ alias_method :base_enc, :enc
25
+ alias_method :base_enc=, :enc=
26
+
27
+ alias_method :base_encoding, :enc
28
+ alias_method :base_encoding=, :enc=
29
+
30
+ #
31
+ # initializer (イニシャライザ)
32
+ # @overload initialize()
33
+ # @overload initialize(root)
34
+ # @param [String] root root directory (基準ディレクトリ)
35
+ # @overload initialize(root, enc)
36
+ # @param [String] root root directory (基準ディレクトリ)
37
+ # @param [String] enc default character encoding (デフォルトエンコーディング)
38
+ # @overload initialize(type, root, enc)
39
+ # @param [FixNum,Symbol] type default type of parser (デフォルトのパーサ・タイプ)
40
+ # @param [String] root root directory (基準ディレクトリ)
41
+ # @param [String] enc default character encoding (デフォルト文字エンコーディング)
42
+ #
43
+ def initialize(*args)
44
+ case args.length
45
+ when 0
46
+ initialize_0
47
+ when 1
48
+ initialize_1(args[0])
49
+ when 2
50
+ initialize_2(args[0], args[1])
51
+ when 3
52
+ initialize_3(args[0], args[1], args[2])
53
+ else
54
+ raise ArgumentError
55
+ end
56
+ end
57
+
58
+ #
59
+ # initializer (イニシャライザ)
60
+ #
61
+ def initialize_0
62
+ @cache = Hash.new
63
+ @root = "."
64
+ @enc = "UTF-8"
65
+ end
66
+
67
+ private :initialize_0
68
+
69
+ #
70
+ # イニシャライザ
71
+ # @param [String] root root directory (基準ディレクトリ)
72
+ #
73
+ def initialize_1(root)
74
+ @cache = Hash.new
75
+ @root = root
76
+ @enc = "UTF-8"
77
+ end
78
+
79
+ private :initialize_1
80
+
81
+ #
82
+ # イニシャライザ
83
+ # @param [String] root root directory (基準ディレクトリ)
84
+ # @param [String] enc default character encoding (デフォルト文字エンコーディング)
85
+ #
86
+ def initialize_2(root, enc)
87
+ @cache = Hash.new
88
+ @root = root
89
+ @enc = enc
90
+ end
91
+
92
+ private :initialize_2
93
+
94
+ #
95
+ # イニシャライザ
96
+ # @param [FixNum,Symbol] type default type of parser (デフォルトのパーサ・タイプ)
97
+ # @param [String] root root directory (基準ディレクトリ)
98
+ # @param [String] enc default character encoding (デフォルト文字エンコーディング)
99
+ #
100
+ def initialize_3(type, root, enc)
101
+ @cache = Hash.new
102
+ @type = type
103
+ @root = root
104
+ @enc = enc
105
+ end
106
+
107
+ private :initialize_3
108
+
109
+ #
110
+ # set options (オプションをセットする)
111
+ # @param [Hash] opts option (オプション)
112
+ # @option opts [String] :root root directory (基準ディレクトリ)
113
+ # @option @deprecated opts [String] :base_dir root directory (基準ディレクトリ)
114
+ # @option opts [String] :enc default character encoding (デフォルト文字エンコーディング)
115
+ # @option @deprecated opts [String] :base_enc default character encoding (デフォルト文字エンコーディング)
116
+ # @option opts [FixNum,Symbol] :type default type of parser (デフォルトのパーサ・タイプ)
117
+ # @option @deprecated opts [FixNum | Symbol] :base_type default type of parser (デフォルトのパーサ・タイプ)
118
+ #
119
+ def options=(opts)
120
+ if opts.kind_of?(Hash)
121
+ if opts.include?(:root)
122
+ @root = opts[:root]
123
+ elsif opts.include?(:base_dir)
124
+ @root = opts[:base_dir]
125
+ end
126
+
127
+ if opts.include?(:enc)
128
+ @enc = opts[:enc]
129
+ elsif opts.include?(:base_enc)
130
+ @enc = opts[:base_enc]
131
+ end
132
+
133
+ if opts.include?(:type)
134
+ @type = opts[:type]
135
+ elsif opts.include?(:base_type)
136
+ @type = opts[:base_type]
137
+ end
138
+ else
139
+ raise ArgumentError
140
+ end
141
+ end
142
+
143
+ #
144
+ #@overload link(relative_path,enc)
145
+ # generate parser (パーサを作成する)
146
+ # @param [String] relative_path relative file path (相対ファイルパス)
147
+ # @param [String] enc character encoding (文字エンコーディング)
148
+ # @return [Meteor::Parser] parser (パーサ)
149
+ #@overload link(relative_path)
150
+ # generate parser (パーサを作成する)
151
+ # @param [String] relative_path relative file path (相対ファイルパス)
152
+ # @return [Meteor::Parser] parser (パーサ)
153
+ #@overload link(type,relative_path,enc)
154
+ # generate parser (パーサを作成する)
155
+ # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
156
+ # @param [String] relative_path relative file path (相対ファイルパス)
157
+ # @param [String] enc character encoding (文字エンコーディング)
158
+ # @return [Meteor::Parser] parser (パーサ)
159
+ #@overload link(type,relative_path)
160
+ # generate parser (パーサを作成する)
161
+ # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
162
+ # @param [String] relative_path relative file path (相対ファイルパス)
163
+ # @return [Meteor::Parser] parser (パーサ)
164
+ #
165
+ def link(*args)
166
+ case args.length
167
+ when 1
168
+ link_1(args[0])
169
+ when 2
170
+ if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
171
+ link_2_n(args[0], args[1])
172
+ elsif args[0].kind_of?(String)
173
+ link_2_s(args[0], args[1])
174
+ else
175
+ raise ArgumentError
176
+ end
177
+
178
+ when 3
179
+ link_3(args[0], args[1], args[2])
180
+ else
181
+ raise ArgumentError
182
+ end
183
+ end
184
+
185
+ #
186
+ # change relative path to relative url (相対パスを相対URLにする)
187
+ # @param [String] path relative path (相対パス)
188
+ # @return [String] relative url (相対URL)
189
+ #
190
+ def path_to_url(path)
191
+ paths = File.split(path)
192
+
193
+ if paths.length == 1
194
+ return File.basename(paths[0], ".*")
195
+ else
196
+ if ".".eql?(paths[0])
197
+ paths.delete_at(0)
198
+ paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
199
+ return String.new("") << "/" << paths.join("/")
200
+ else
201
+ paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
202
+ return String.new("") << "/" << paths.join("/")
203
+ end
204
+ end
205
+ end
206
+
207
+ private :path_to_url
208
+
209
+ #
210
+ # generate parser (パーサを作成する)
211
+ # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
212
+ # @param [String] relative_path relative file path (相対ファイルパス)
213
+ # @param [String] enc character encoding (文字エンコーディング)
214
+ # @return [Meteor::Parser] parser(パーサ)
215
+ #
216
+ def link_3(type, relative_path, enc)
217
+
218
+ relative_url = path_to_url(relative_path)
219
+
220
+ case type
221
+ when Parser::HTML, :html, :html5
222
+ html = Meteor::Ml::Html::ParserImpl.new
223
+ html.read(File.expand_path(relative_path, @root), enc)
224
+ @cache[relative_url] = html
225
+ when Parser::XML, :xml
226
+ xml = Meteor::Ml::Xml::ParserImpl.new
227
+ xml.read(File.expand_path(relative_path, @root), enc)
228
+ @cache[relative_url] = xml
229
+ when Parser::XHTML, :xhtml, :xhtml5
230
+ xhtml = Meteor::Ml::Xhtml::ParserImpl.new
231
+ xhtml.read(File.expand_path(relative_path, @root), enc)
232
+ @cache[relative_url] = xhtml
233
+ when Parser::HTML4, :html4
234
+ html4 = Meteor::Ml::Html4::ParserImpl.new
235
+ html.read(File.expand_path(relative_path, @root), enc)
236
+ @cache[relative_url] = html4
237
+ when Parser::XHTML4, :xhtml4
238
+ xhtml4 = Meteor::Ml::Xhtml4::ParserImpl.new
239
+ xhtml4.read(File.expand_path(relative_path, @root), enc)
240
+ @cache[relative_url] = xhtml4
241
+ end
242
+ end
243
+
244
+ private :link_3
245
+
246
+ #
247
+ # generate parser (パーサを作成する)
248
+ # @param [Fixnum,Symbol] type type of parser(パーサ・タイプ)
249
+ # @param [String] relative_path relative file path (相対ファイルパス)
250
+ # @return [Meteor::Parser] parser (パーサ)
251
+ #
252
+ def link_2_n(type, relative_path)
253
+
254
+ relative_url = path_to_url(relative_path)
255
+
256
+ case type
257
+ when Parser::HTML, :html, :html5
258
+ ps = Meteor::Ml::Html::ParserImpl.new
259
+ when Parser::XML, :xml
260
+ ps = Meteor::Ml::Xml::ParserImpl.new
261
+ when Parser::XHTML, :xhtml, :xhtml5
262
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
263
+ when Parser::HTML4, :html4
264
+ ps = Meteor::Ml::Html4::ParserImpl.new
265
+ when Parser::XHTML4, :xhtml4
266
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
267
+ end
268
+
269
+ ps.read(File.expand_path(relative_path, @root), @enc)
270
+ @cache[relative_url] = ps
271
+ end
272
+
273
+ private :link_2_n
274
+
275
+ #
276
+ # generate parser (パーサを作成する)
277
+ # @param [String] relative_path relative file path (相対ファイルパス)
278
+ # @param [String] enc character encoding (文字エンコーディング)
279
+ # @return [Meteor::Parser] parser (パーサ)
280
+ #
281
+ def link_2_s(relative_path, enc)
282
+
283
+ relative_url = path_to_url(relative_path)
284
+
285
+ case @type
286
+ when Parser::HTML, :html
287
+ ps = Meteor::Ml::Html::ParserImpl.new
288
+ when Parser::XML, :xml
289
+ ps = Meteor::Ml::Xml::ParserImpl.new
290
+ when Parser::XHTML, :xhtml
291
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
292
+ when Parser::HTML4, :html4
293
+ ps = Meteor::Ml::Html4::ParserImpl.new
294
+ when Parser::XHTML4, :xhtml4
295
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
296
+ end
297
+
298
+ ps.read(File.expand_path(relative_path, @root), enc)
299
+ @cache[relative_url] = ps
300
+ end
301
+
302
+ private :link_2_s
303
+
304
+ #
305
+ # generate parser (パーサを作成する)
306
+ # @param [String] relative_path relative file path (相対ファイルパス)
307
+ # @return [Meteor::Parser] parser (パーサ)
308
+ #
309
+ def link_1(relative_path)
310
+
311
+ relative_url = path_to_url(relative_path)
312
+
313
+ case @type
314
+ when Parser::HTML, :html
315
+ ps = Meteor::Ml::Html::ParserImpl.new
316
+ when Parser::XML, :xml
317
+ ps = Meteor::Ml::Xml::ParserImpl.new
318
+ when Parser::XHTML, :xhtml
319
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
320
+ when Parser::HTML4, :html4
321
+ ps = Meteor::Ml::Html4::ParserImpl.new
322
+ when Parser::XHTML4, :xhtml4
323
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
324
+ else
325
+ raise ArgumentError
326
+ end
327
+
328
+ ps.read(File.expand_path(relative_path, @root), @enc)
329
+ @cache[relative_url] = ps
330
+ end
331
+
332
+ private :link_1
333
+
334
+ #
335
+ #@overload parser(key)
336
+ # get parser (パーサを取得する)
337
+ # @param [String,Symbol] key identifier (キー)
338
+ # @return [Meteor::Parser] parser (パーサ)
339
+ #@overload parser(type,relative_path,enc)
340
+ # generate parser (パーサを作成する)
341
+ # @param [Fixnum] type type of parser (パーサ・タイプ)
342
+ # @param [String] relative_path relative file path (相対ファイルパス)
343
+ # @param [String] enc character encoding (エンコーディング)
344
+ # @return [Meteor::Parser] parser (パーサ)
345
+ # @deprecated
346
+ #@overload parser(type,relative_path)
347
+ # generate parser (パーサを作成する)
348
+ # @param [Fixnum] type type of parser (パーサ・タイプ)
349
+ # @param [String] relative_path relative file path (相対ファイルパス)
350
+ # @return [Meteor::Parser] parser (パーサ)
351
+ # @deprecated
352
+ def parser(*args)
353
+ case args.length
354
+ when 1
355
+ parser_1(args[0])
356
+ when 2, 3
357
+ link(args)
358
+ end
359
+ # parser_1(key)
360
+ end
361
+
362
+ #
363
+ # get parser (パーサを取得する)
364
+ # @param [String] key identifier (キー)
365
+ # @return [Meteor::Parser] parser (パーサ)
366
+ #
367
+ def parser_1(key)
368
+ @pif = @cache[key.to_s]
369
+ case @pif.doc_type
370
+ when Meteor::Parser::HTML
371
+ Meteor::Ml::Html::ParserImpl.new(@pif)
372
+ when Meteor::Parser::XML
373
+ Meteor::Ml::Xml::ParserImpl.new(@pif)
374
+ when Meteor::Parser::XHTML
375
+ Meteor::Ml::Xhtml::ParserImpl.new(@pif)
376
+ when Meteor::Parser::HTML4
377
+ Meteor::Ml::Html4::ParserImpl.new(@pif)
378
+ when Meteor::Parser::XHTML4
379
+ Meteor::Ml::Xhtml4::ParserImpl.new(@pif)
380
+ end
381
+ end
382
+
383
+ private :parser_1
384
+
385
+ #
386
+ # get root element (ルート要素を取得する)
387
+ # @param [String,Symbol] key identifier (キー)
388
+ # @return [Meteor::RootElement] root element (ルート要素)
389
+ #
390
+ def element(key)
391
+ parser_1(key).root_element
392
+ end
393
+
394
+ #
395
+ # @overload link_str(type, relative_url, doc)
396
+ # generate parser (パーサを作成する)
397
+ # @param [Fixnum] type type of parser (パーサ・タイプ)
398
+ # @param [String] relative_url relative URL (相対URL)
399
+ # @param [String] doc document (ドキュメント)
400
+ # @return [Meteor::Parser] parser (パーサ)
401
+ # @overload link_str(relative_url, doc)
402
+ # generate parser (パーサを作成する)
403
+ # @param [String] relative_url relative URL (相対URL)
404
+ # @param [String] doc document (ドキュメント)
405
+ # @return [Meteor::Parser] parser (パーサ)
406
+ #
407
+ def link_str(*args)
408
+ case args.length
409
+ when 2
410
+ link_str_2(args[0], args[1])
411
+ when 3
412
+ link_str_3(args[0], args[1], args[2])
413
+ else
414
+ raise ArgumentError
415
+ end
416
+ end
417
+
418
+ #
419
+ # generate parser (パーサを作成する)
420
+ # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
421
+ # @param [String] relative_url relative URL (相対URL)
422
+ # @param [String] doc document (ドキュメント)
423
+ # @return [Meteor::Parser] parser (パーサ)
424
+ #
425
+ def link_str_3(type, relative_url, doc)
426
+ case type
427
+ when Parser::HTML, :html
428
+ ps = Meteor::Ml::Html::ParserImpl.new
429
+ when Parser::XML, :xml
430
+ ps = Meteor::Ml::Xml::ParserImpl.new
431
+ when Parser::XHTML, :xhtml
432
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
433
+ when Parser::HTML4, :html4
434
+ ps = Meteor::Ml::Html4::ParserImpl.new
435
+ when Parser::XHTML4, :xhtml4
436
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
437
+ end
438
+
439
+ ps.dcument = doc
440
+ ps.parse
441
+ @cache[relative_url] = ps
442
+ end
443
+
444
+ private :link_str_3
445
+
446
+ #
447
+ # generate parser (パーサを作成する)
448
+ # @param [String] relative_url relative URL (相対URL)
449
+ # @param [String] doc document (ドキュメント)
450
+ # @return [Meteor::Parser] parser (パーサ)
451
+ #
452
+ def link_str_2(relative_url, doc)
453
+ case @type
454
+ when Parser::HTML, :html
455
+ ps = Meteor::Ml::Html::ParserImpl.new
456
+ when Parser::XML, :xml
457
+ ps = Meteor::Ml::Xml::ParserImpl.new
458
+ when Parser::XHTML, :xhtml
459
+ ps = Meteor::Ml::Xhtml::ParserImpl.new
460
+ when Parser::HTML4, :html4
461
+ ps = Meteor::Ml::Html4::ParserImpl.new
462
+ when Parser::XHTML4, :xhtml4
463
+ ps = Meteor::Ml::Xhtml4::ParserImpl.new
464
+ end
465
+
466
+ ps.document = doc
467
+ ps.parse
468
+ @cache[relative_url] = ps
469
+ end
470
+
471
+ private :link_str_2
472
+
473
+ alias :paraser_str :link_str
474
+
475
+ #
476
+ # set parser (パーサをセットする)
477
+ # @param [String,Symbol] key identifier (キー)
478
+ # @param [Meteor::Parser] ps parser (パーサ)
479
+ #
480
+ def []=(key, ps)
481
+ @cache[key] = ps
482
+ end
483
+
484
+ #
485
+ # get parser (パーサを取得する)
486
+ # @param [String,Symbol] key identifier (キー)
487
+ # @return [Meteor::Parser] parser (パーサ)
488
+ #
489
+ def [](key)
490
+ self.parser(key)
491
+ end
492
+ end
493
+ end
@@ -0,0 +1,24 @@
1
+ # -* coding: UTF-8 -*-
2
+ # frozen_string_literal: true
3
+
4
+ module Meteor
5
+ #
6
+ # root element class (ルート要素クラス)
7
+ #
8
+ # @!attribute [rw] content_type
9
+ # @return [String] content type (コンテントタイプ)
10
+ # @!attribute [rw] kaigyo_code
11
+ # @return [String] newline (改行コード)
12
+ # @!attribute [rw] charset
13
+ # @return [String] charset (文字コード)
14
+ # @!attribute [rw] character_encoding
15
+ # @return [String] character encoding (文字エンコーディング)
16
+ #
17
+ class RootElement < Element
18
+ attr_accessor :content_type
19
+ attr_accessor :kaigyo_code
20
+ attr_accessor :charset
21
+ attr_accessor :character_encoding
22
+ # attr_accessor :document #[String] document (ドキュメント)
23
+ end
24
+ end