meteor 0.9.16 → 0.9.17

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f7d47ad0742865e6db6e46f77760be2e297d06801994d8946d5d214b62eabb2c
4
- data.tar.gz: 9589c40343c33e537a172f2f7473eacb0c2e76cd68bc2718b8795c9400b7e1fa
3
+ metadata.gz: 5a115fb12155d38898790a30ed917abe7e22fdac5ce8d4bc76e732e0eb2c4b64
4
+ data.tar.gz: f673cc5f72f4a3c9c8253d8fee3cb44365894911f9ad4863eb29693d10fe36b2
5
5
  SHA512:
6
- metadata.gz: 3499c0efa7aa62b76a5ad077855b1c8da0c715396ee0979a9c6103a3a8f7b85606558794be63b64c012864c53b915556ae165da6d282af616b6912342689fd0f
7
- data.tar.gz: a4d2d9d1d8ec23285c94840934967c37ac7921813c951b8ec0c1e52ed3cb968cd678f080f646c0aa67676596b5abff91e24337820ef67ff10973364223042c4a
6
+ metadata.gz: 2fe5a34dc71d3f5f889300653179b98d9c81b87652c1658e95c091b89079f97eeb4e1e8489a4cc037eda6dc935dc6f4d0a8fa56e2b0c04cb26e3dd6780bfda0c
7
+ data.tar.gz: 2b578499df7e05f249f493ee6646f026655f3eeb6b819e01b0822a8f83256cc6d39410907f0ecb28f62f0a4dedca2bcf9da6b46b9b121cdf496d2232cc4aac70
data/ChangeLog CHANGED
@@ -1,3 +1,7 @@
1
+ == 0.9.17 / 2026-06-19 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
1
5
  == 0.9.16 / 2026-06-18 Yasumasa Ashida <ys.ashida@gmail.com>
2
6
 
3
7
  * Refactoring
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.16)
4
+ meteor (0.9.17)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/demo/html.rb CHANGED
@@ -5,8 +5,8 @@
5
5
  # require 'rubygems'
6
6
  require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(:html, "ml/sample_html.html", "UTF-8")
9
- root = Meteor::ElementFactory.element("/ml/sample_html")
8
+ Meteor::Elements.add(:html, "ml/sample_html.html", "UTF-8")
9
+ root = Meteor::Elements.get("/ml/sample_html")
10
10
 
11
11
  start_time = Time.new.to_f
12
12
 
data/demo/html4.rb CHANGED
@@ -5,11 +5,11 @@
5
5
  # require 'rubygems'
6
6
  require "meteor"
7
7
 
8
- # Meteor::ElementFactory.link(:html4,'ml/sample_4.html', 'UTF-8')
9
- Meteor::ElementFactory.options = {type: :html4}
10
- Meteor::ElementFactory.link("ml/sample_html4.html")
8
+ # Meteor::Elements.add(:html4,'ml/sample_4.html', 'UTF-8')
9
+ Meteor::Elements.options = {type: :html4}
10
+ Meteor::Elements.add("ml/sample_html4.html")
11
11
 
12
- root = Meteor::ElementFactory.element("/ml/sample_html4")
12
+ root = Meteor::Elements.get("/ml/sample_html4")
13
13
 
14
14
  start_time = Time.new.to_f
15
15
 
data/demo/xhtml.rb CHANGED
@@ -5,8 +5,8 @@
5
5
  # require 'rubygems'
6
6
  require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(:xhtml, "ml/sample_xhtml.html", "UTF-8")
9
- root = Meteor::ElementFactory.element("/ml/sample_xhtml")
8
+ Meteor::Elements.add(:xhtml, "ml/sample_xhtml.html", "UTF-8")
9
+ root = Meteor::Elements.get("/ml/sample_xhtml")
10
10
 
11
11
  startTime = Time.new.to_f
12
12
 
data/demo/xhtml4.rb CHANGED
@@ -5,8 +5,8 @@
5
5
  # require 'rubygems'
6
6
  require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(:xhtml4, "ml/sample_xhtml4.html", "UTF-8")
9
- root = Meteor::ElementFactory.element("/ml/sample_xhtml4")
8
+ Meteor::Elements.add(:xhtml4, "ml/sample_xhtml4.html", "UTF-8")
9
+ root = Meteor::Elements.get("/ml/sample_xhtml4")
10
10
 
11
11
  startTime = Time.new.to_f
12
12
 
data/demo/xml.rb CHANGED
@@ -5,8 +5,8 @@
5
5
  # require 'rubygems'
6
6
  require "meteor"
7
7
 
8
- Meteor::ElementFactory.link(Meteor::XML, "ml/sample.xml", "UTF-8")
9
- root = Meteor::ElementFactory.element("/ml/sample")
8
+ Meteor::Elements.add(Meteor::XML, "ml/sample.xml", "UTF-8")
9
+ root = Meteor::Elements.get("/ml/sample")
10
10
 
11
11
  start_time = Time.new.to_f
12
12
 
@@ -463,7 +463,6 @@ module Meteor
463
463
  @elm_.empty = true
464
464
 
465
465
  @elm_.parser = self
466
-
467
466
  when FIVE
468
467
  # element (要素)
469
468
  @elm_ = Meteor::Element.new(name)
@@ -596,7 +595,6 @@ module Meteor
596
595
  # @return [Meteor::Element] element (要素)
597
596
  #
598
597
  def element_2(attr_name, attr_value)
599
-
600
598
  quote_attribute(attr_name, attr_value)
601
599
 
602
600
  element_pattern_2
@@ -613,7 +611,6 @@ module Meteor
613
611
 
614
612
  @elm_ = nil
615
613
  end
616
- #=end
617
614
 
618
615
  =begin
619
616
  @pattern_cc_1 = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)\\/>|<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(\\3[^<>]*>)).)*)<\\/\\3>"
@@ -1056,7 +1053,6 @@ module Meteor
1056
1053
  # @return [Meteor::Element] element (要素)
1057
1054
  #
1058
1055
  def element_4(attr_name1, attr_value1, attr_name2, attr_value2)
1059
-
1060
1056
  quote_element_4(attr_name1, attr_value1, attr_name2, attr_value2)
1061
1057
 
1062
1058
  element_pattern_4
@@ -1792,7 +1788,6 @@ module Meteor
1792
1788
  # @return [Meteor::Element] element (要素)
1793
1789
  #
1794
1790
  def set_content_3(elm, content, entity_ref = true)
1795
-
1796
1791
  if entity_ref || !elm.raw_content
1797
1792
  escape_content(content, elm)
1798
1793
  end
@@ -3,10 +3,10 @@
3
3
 
4
4
  module Meteor
5
5
  #
6
- # Element Factory Class (要素ファクトリ クラス)
6
+ # Elements Class (要素ファクトリ クラス)
7
7
  #
8
- class ElementFactory
9
- @@pf = Meteor::ParserFactory.new
8
+ class Elements
9
+ @@pf = Meteor::Parsers.new
10
10
 
11
11
  #
12
12
  # set options (オプションをセットする)
@@ -23,37 +23,42 @@ module Meteor
23
23
  end
24
24
 
25
25
  #
26
- #@overload link(type,relative_path,enc)
26
+ #@overload add(type,relative_path,enc)
27
27
  # generate parser (パーサを作成する)
28
28
  # @param [Fixnum] type type of parser (パーサ・タイプ)
29
29
  # @param [String] relative_path relative file path (相対ファイルパス)
30
30
  # @param [String] enc character encoding (エンコーディング)
31
31
  # @return [Meteor::Parser] parser (パーサ)
32
- #@overload link(type,relative_path)
32
+ #@overload add(type,relative_path)
33
33
  # generate parser (パーサを作成する)
34
34
  # @param [Fixnum] type type of parser (パーサ・タイプ)
35
35
  # @param [String] relative_path relative file path (相対ファイルパス)
36
36
  # @return [Meteor::Parser] parser (パーサ)
37
37
  #
38
- def self.link(*args)
39
- @@pf.link(*args)
38
+ def self.add(*args)
39
+ @@pf.add(*args)
40
40
  end
41
41
 
42
42
  #
43
- # @overload link_str(type, relative_url, doc)
43
+ # @overload add_str(type, relative_url, doc)
44
44
  # generate parser (パーサを作成する)
45
45
  # @param [Fixnum] type type of parser (パーサ・タイプ)
46
46
  # @param [String] relative_url relative URL (相対URL)
47
47
  # @param [String] doc document (ドキュメント)
48
48
  # @return [Meteor::Parser] parser (パーサ)
49
- # @overload link_str(relative_url, doc)
49
+ # @overload add_str(relative_url, doc)
50
50
  # generate parser (パーサを作成する)
51
51
  # @param [String] relative_url relative URL (相対URL)
52
52
  # @param [String] doc document (ドキュメント)
53
53
  # @return [Meteor::Parser] parser (パーサ)
54
54
  #
55
- def self.link_str(*args)
56
- @@pf.link_str(args)
55
+ def self.add_str(*args)
56
+ @@pf.add_str(args)
57
+ end
58
+
59
+ class << self
60
+ alias_method :link, :add
61
+ alias_method :link_str, :add_str
57
62
  end
58
63
 
59
64
  #
@@ -61,8 +66,17 @@ module Meteor
61
66
  # @param [String,Symbol] key identifier (キー)
62
67
  # @return [Meteor::RootElement] root element (ルート要素)
63
68
  #
64
- def self.element(key)
69
+ def self.get(key)
65
70
  @@pf.element(key)
66
71
  end
72
+
73
+ class << self
74
+ alias_method :element, :get
75
+ end
67
76
  end
77
+
78
+ #
79
+ # Elements Class (要素ファクトリ クラス)
80
+ #
81
+ Elements = Elements
68
82
  end
@@ -351,7 +351,6 @@ module Meteor
351
351
  # @return [Meteor::Element] element (要素)
352
352
  #
353
353
  def element_2(attr_name, attr_value)
354
-
355
354
  quote_attribute(attr_name, attr_value)
356
355
 
357
356
  # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value
@@ -386,7 +385,6 @@ module Meteor
386
385
  # @return [Meteor::Element] element (要素)
387
386
  #
388
387
  def element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
389
-
390
388
  quote_element_5(name, attr_name1, attr_value1, attr_name2, attr_value2)
391
389
 
392
390
  # 空要素の場合(<->内容あり要素の場合)
@@ -579,7 +577,6 @@ module Meteor
579
577
  private :get_type
580
578
 
581
579
  def get_attr_value_r(elm, match_p)
582
-
583
580
  @res = match_p.match(elm.attributes)
584
581
 
585
582
  if @res
@@ -51,8 +51,6 @@ module Meteor
51
51
  # end
52
52
  #
53
53
  # private :initialize_0
54
- #
55
- # private :initialize_0
56
54
 
57
55
  #
58
56
  # initializer (イニシャライザ)
@@ -12,7 +12,7 @@ module Meteor
12
12
  # @!attribute [rw] enc
13
13
  # @return [String] default character encoding (デフォルトエンコーディング)
14
14
  #
15
- class ParserFactory
15
+ class Parsers
16
16
  attr_accessor :type
17
17
  attr_accessor :root
18
18
  attr_accessor :enc
@@ -137,47 +137,48 @@ module Meteor
137
137
  end
138
138
 
139
139
  #
140
- #@overload link(relative_path,enc)
140
+ #@overload add(relative_path,enc)
141
141
  # generate parser (パーサを作成する)
142
142
  # @param [String] relative_path relative file path (相対ファイルパス)
143
143
  # @param [String] enc character encoding (文字エンコーディング)
144
144
  # @return [Meteor::Parser] parser (パーサ)
145
- #@overload link(relative_path)
145
+ #@overload add(relative_path)
146
146
  # generate parser (パーサを作成する)
147
147
  # @param [String] relative_path relative file path (相対ファイルパス)
148
148
  # @return [Meteor::Parser] parser (パーサ)
149
- #@overload link(type,relative_path,enc)
149
+ #@overload add(type,relative_path,enc)
150
150
  # generate parser (パーサを作成する)
151
151
  # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
152
152
  # @param [String] relative_path relative file path (相対ファイルパス)
153
153
  # @param [String] enc character encoding (文字エンコーディング)
154
154
  # @return [Meteor::Parser] parser (パーサ)
155
- #@overload link(type,relative_path)
155
+ #@overload add(type,relative_path)
156
156
  # generate parser (パーサを作成する)
157
157
  # @param [Fixnum,Symbol] type type of parser (パーサ・タイプ)
158
158
  # @param [String] relative_path relative file path (相対ファイルパス)
159
159
  # @return [Meteor::Parser] parser (パーサ)
160
160
  #
161
- def link(*args)
161
+ def add(*args)
162
162
  case args.length
163
163
  when 1
164
- link_1(args[0])
164
+ add_1(args[0])
165
165
  when 2
166
166
  if args[0].kind_of?(Fixnum) || args[0].kind_of?(Symbol)
167
- link_2_n(args[0], args[1])
167
+ add_2_n(args[0], args[1])
168
168
  elsif args[0].kind_of?(String)
169
- link_2_s(args[0], args[1])
169
+ add_2_s(args[0], args[1])
170
170
  else
171
171
  raise ArgumentError
172
172
  end
173
-
174
173
  when 3
175
- link_3(args[0], args[1], args[2])
174
+ add_3(args[0], args[1], args[2])
176
175
  else
177
176
  raise ArgumentError
178
177
  end
179
178
  end
180
179
 
180
+ alias_method :link, :add
181
+
181
182
  #
182
183
  # change relative path to relative url (相対パスを相対URLにする)
183
184
  # @param [String] path relative path (相対パス)
@@ -209,15 +210,15 @@ module Meteor
209
210
  # @param [String] enc character encoding (文字エンコーディング)
210
211
  # @return [Meteor::Parser] parser(パーサ)
211
212
  #
212
- def link_3(type, relative_path, enc)
213
- relative_url = path_to_url(relative_path)
214
-
213
+ def add_3(type, relative_path, enc = "UTF-8")
215
214
  ps = new_parser(type)
216
215
  ps.read(File.expand_path(relative_path, @root), enc)
216
+
217
+ relative_url = path_to_url(relative_path)
217
218
  @cache[relative_url] = ps
218
219
  end
219
220
 
220
- private :link_3
221
+ private :add_3
221
222
 
222
223
  #
223
224
  # generate parser (パーサを作成する)
@@ -225,15 +226,11 @@ module Meteor
225
226
  # @param [String] relative_path relative file path (相対ファイルパス)
226
227
  # @return [Meteor::Parser] parser (パーサ)
227
228
  #
228
- def link_2_n(type, relative_path)
229
- relative_url = path_to_url(relative_path)
230
-
231
- ps = new_parser(type)
232
- ps.read(File.expand_path(relative_path, @root), @enc)
233
- @cache[relative_url] = ps
229
+ def add_2_n(type, relative_path)
230
+ add_3(type, relative_path, @enc)
234
231
  end
235
232
 
236
- private :link_2_n
233
+ private :add_2_n
237
234
 
238
235
  #
239
236
  # generate parser (パーサを作成する)
@@ -241,30 +238,22 @@ module Meteor
241
238
  # @param [String] enc character encoding (文字エンコーディング)
242
239
  # @return [Meteor::Parser] parser (パーサ)
243
240
  #
244
- def link_2_s(relative_path, enc)
245
- relative_url = path_to_url(relative_path)
246
-
247
- ps = new_parser(@type)
248
- ps.read(File.expand_path(relative_path, @root), enc)
249
- @cache[relative_url] = ps
241
+ def add_2_s(relative_path, enc)
242
+ add_3(@type, relative_path, enc)
250
243
  end
251
244
 
252
- private :link_2_s
245
+ private :add_2_s
253
246
 
254
247
  #
255
248
  # generate parser (パーサを作成する)
256
249
  # @param [String] relative_path relative file path (相対ファイルパス)
257
250
  # @return [Meteor::Parser] parser (パーサ)
258
251
  #
259
- def link_1(relative_path)
260
- relative_url = path_to_url(relative_path)
261
-
262
- ps = new_parser(@type)
263
- ps.read(File.expand_path(relative_path, @root), @enc)
264
- @cache[relative_url] = ps
252
+ def add_1(relative_path)
253
+ add_3(@type, relative_path, @enc)
265
254
  end
266
255
 
267
- private :link_1
256
+ private :add_1
268
257
 
269
258
  #
270
259
  #@overload parser(key)
@@ -289,7 +278,7 @@ module Meteor
289
278
  when 1
290
279
  parser_1(args[0])
291
280
  when 2, 3
292
- link(args)
281
+ add(args)
293
282
  end
294
283
  # parser_1(key)
295
284
  end
@@ -327,24 +316,24 @@ module Meteor
327
316
  end
328
317
 
329
318
  #
330
- # @overload link_str(type, relative_url, doc)
319
+ # @overload add_str(type, relative_url, doc)
331
320
  # generate parser (パーサを作成する)
332
321
  # @param [Fixnum] type type of parser (パーサ・タイプ)
333
322
  # @param [String] relative_url relative URL (相対URL)
334
323
  # @param [String] doc document (ドキュメント)
335
324
  # @return [Meteor::Parser] parser (パーサ)
336
- # @overload link_str(relative_url, doc)
325
+ # @overload add_str(relative_url, doc)
337
326
  # generate parser (パーサを作成する)
338
327
  # @param [String] relative_url relative URL (相対URL)
339
328
  # @param [String] doc document (ドキュメント)
340
329
  # @return [Meteor::Parser] parser (パーサ)
341
330
  #
342
- def link_str(*args)
331
+ def add_str(*args)
343
332
  case args.length
344
333
  when 2
345
- link_str_2(args[0], args[1])
334
+ add_str_2(args[0], args[1])
346
335
  when 3
347
- link_str_3(args[0], args[1], args[2])
336
+ add_str_3(args[0], args[1], args[2])
348
337
  else
349
338
  raise ArgumentError
350
339
  end
@@ -357,15 +346,15 @@ module Meteor
357
346
  # @param [String] doc document (ドキュメント)
358
347
  # @return [Meteor::Parser] parser (パーサ)
359
348
  #
360
- def link_str_3(type, relative_url, doc)
361
- ps = new_parser(@type)
362
-
363
- ps.dcument = doc
349
+ def add_str_3(type, relative_url, doc)
350
+ ps = new_parser(type)
351
+ ps.document = doc
364
352
  ps.parse
353
+
365
354
  @cache[relative_url] = ps
366
355
  end
367
356
 
368
- private :link_str_3
357
+ private :add_str_3
369
358
 
370
359
  #
371
360
  # generate parser (パーサを作成する)
@@ -373,17 +362,14 @@ module Meteor
373
362
  # @param [String] doc document (ドキュメント)
374
363
  # @return [Meteor::Parser] parser (パーサ)
375
364
  #
376
- def link_str_2(relative_url, doc)
377
- ps = new_parser(@type)
378
-
379
- ps.document = doc
380
- ps.parse
381
- @cache[relative_url] = ps
365
+ def add_str_2(relative_url, doc)
366
+ add_str_3(@type, relative_url, doc)
382
367
  end
383
368
 
384
- private :link_str_2
369
+ private :add_str_2
385
370
 
386
- alias :paraser_str :link_str
371
+ alias_method :link_str, :add_str
372
+ alias_method :parser_str, :add_str
387
373
 
388
374
  def new_parser(type)
389
375
  case type
@@ -422,4 +408,9 @@ module Meteor
422
408
  self.parser(key)
423
409
  end
424
410
  end
411
+
412
+ #
413
+ # Parser Factory Class (パーサ・ファクトリ クラス)
414
+ #
415
+ ParserFactory = Parsers
425
416
  end
data/lib/meteor.rb CHANGED
@@ -6,8 +6,8 @@ require "meteor/root_element"
6
6
  require "meteor/attribute"
7
7
  require "meteor/attribute_map"
8
8
  require "meteor/parser"
9
- require "meteor/parser_factory"
10
- require "meteor/element_factory"
9
+ require "meteor/parsers"
10
+ require "meteor/elements"
11
11
  require "meteor/exception/no_such_element_exception"
12
12
  require "meteor/core/kernel"
13
13
  require "meteor/core/util/pattern_cache"
@@ -36,11 +36,11 @@ require "meteor/ml/xml/parser_impl"
36
36
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
37
37
  #
38
38
  # @author Yasumasa Ashida
39
- # @version 0.9.16
39
+ # @version 0.9.17
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = "0.9.16"
43
+ VERSION = "0.9.17"
44
44
 
45
45
  # require 'fileutils'
46
46
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: meteor
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.16
4
+ version: 0.9.17
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida
@@ -51,7 +51,7 @@ files:
51
51
  - lib/meteor/core/kernel.rb
52
52
  - lib/meteor/core/util/pattern_cache.rb
53
53
  - lib/meteor/element.rb
54
- - lib/meteor/element_factory.rb
54
+ - lib/meteor/elements.rb
55
55
  - lib/meteor/exception/no_such_element_exception.rb
56
56
  - lib/meteor/ml/html/parser_impl.rb
57
57
  - lib/meteor/ml/html4/parser_impl.rb
@@ -59,7 +59,7 @@ files:
59
59
  - lib/meteor/ml/xhtml4/parser_impl.rb
60
60
  - lib/meteor/ml/xml/parser_impl.rb
61
61
  - lib/meteor/parser.rb
62
- - lib/meteor/parser_factory.rb
62
+ - lib/meteor/parsers.rb
63
63
  - lib/meteor/root_element.rb
64
64
  - meteor.gemspec
65
65
  - test/meteor_test.rb