meteor 0.9.38 → 0.9.40

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: f9f19ba1ec59b27169b092cf733dd33ad1caf394d1bdfed7750bab164a55a86f
4
- data.tar.gz: a8a45526d84143a892bd7e052815199de8815ace68a7b522eb1d6a8cbcf83e24
3
+ metadata.gz: a8a5ce47fc5de4ccdb94ed15e152a80efe36dc1765ca73e5b864d03bdc6feac7
4
+ data.tar.gz: 820d8b7df1c57df54a31099a3191a2d54798e729748aa98516f4d36158b2887f
5
5
  SHA512:
6
- metadata.gz: 8feb661b6a9fed19dac6cf1fd5c650a77477fe2a72b4f326038fdb7b304d521a042ca304e75444d2fe8fdb6dfcd31f7be7df8ac9d3ce4dcda81aa3ffca4fb51e
7
- data.tar.gz: c48f7bdd524d73b39e0d80a75d3a7497937a19f8ab3bfda309fe48e1dfc9358ffbc4c128db8fc98c9c55148182212fc1863be9d31246dba3adb5af327a13f8ea
6
+ metadata.gz: f3698775f588bfc8b5ceeca48cf5ffef533cc028822e986a7a98283547740f75c6f22a3035565defcbc7ccc990b0d30a375a2416bd10f8022d3b7348084840b5
7
+ data.tar.gz: 28b21ad8f65b972f5dd3dfdcdb7f60e6407e575d7c6e1d5e8f8c586776f68230005242a3d3251659b9b978a4e5bcfd6456b21e161169bb734b4afd31696e90b0
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.40 / 2026-07-13 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Fix comments
4
+
5
+ == 0.9.39 / 2026-07-09 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Refactor Meteor::Parsers
8
+
1
9
  == 0.9.38 / 2026-07-08 Yasumasa Ashida <ys.ashida@gmail.com>
2
10
 
3
11
  * Refactor Meteor::Ml::(Html4|Xhtml4|Xml)::ParserImpl
data/Gemfile CHANGED
@@ -5,4 +5,4 @@ source 'https://rubygems.org'
5
5
  # Specify your gem's dependencies in meteor.gemspec
6
6
  gemspec name: 'meteor'
7
7
 
8
- gem 'rubocop', '~> 1.88.1'
8
+ gem 'rubocop', '~> 1.88.2'
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.38)
4
+ meteor (0.9.40)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -18,7 +18,7 @@ GEM
18
18
  racc (1.8.1)
19
19
  rainbow (3.1.1)
20
20
  regexp_parser (2.12.0)
21
- rubocop (1.88.1)
21
+ rubocop (1.88.2)
22
22
  json (~> 2.3)
23
23
  language_server-protocol (~> 3.17.0.2)
24
24
  lint_roller (~> 1.1.0)
@@ -41,9 +41,9 @@ PLATFORMS
41
41
  ruby
42
42
 
43
43
  DEPENDENCIES
44
- bundler (~> 4.0.13)
44
+ bundler (~> 4.0.15)
45
45
  meteor!
46
- rubocop (~> 1.88.1)
46
+ rubocop (~> 1.88.2)
47
47
 
48
48
  BUNDLED WITH
49
- 4.0.13
49
+ 4.0.15
@@ -50,7 +50,7 @@ module Meteor
50
50
  # @param [String,Symbol] name attribute name (属性名)
51
51
  # @param [String] value attribute value (属性値)
52
52
  #
53
- def store(name, value)
53
+ def store(name, value) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
54
54
  if !@map[name]
55
55
  attr = Attribute.new
56
56
  attr.name = name
@@ -222,7 +222,7 @@ module Meteor
222
222
  # @param [Meteor::Element] elm element (要素)
223
223
  # @return [Meteor::Element] element (要素)
224
224
  #
225
- def element(elm, attrs = nil, *args)
225
+ def element(elm, attrs = nil, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
226
226
  if !attrs
227
227
  case elm
228
228
  when String, Symbol
@@ -284,7 +284,7 @@ module Meteor
284
284
  # @param [String,Symbol] name tag name (タグ名)
285
285
  # @return [Meteor::Element] element(要素)
286
286
  #
287
- def element_one(name)
287
+ def element_one(name) # rubocop:disable Metrics/MethodLength
288
288
  quote_name(name)
289
289
 
290
290
  # element search pattern (要素検索用パターン)
@@ -309,7 +309,7 @@ module Meteor
309
309
 
310
310
  private :element_one
311
311
 
312
- def element_normal_one(name)
312
+ def element_normal_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
313
313
  @elm_ = Meteor::Element.new(name)
314
314
 
315
315
  if @on_search
@@ -371,7 +371,7 @@ module Meteor
371
371
  # @param [String] attr_value attribute value (属性値)
372
372
  # @param [true,false] quote flag (クオート・フラグ)
373
373
  # @return [Meteor::Element] element (要素)
374
- def element_three(name, attr_name, attr_value, quote = true)
374
+ def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
375
375
  if quote
376
376
  quote_element_three(name, attr_name, attr_value)
377
377
  else
@@ -441,7 +441,7 @@ module Meteor
441
441
 
442
442
  private :quote_element_three
443
443
 
444
- def element_normal_three_one(name)
444
+ def element_normal_three_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
445
445
  # puts @res.captures.length
446
446
  case @res.captures.length
447
447
  when FOUR
@@ -525,7 +525,7 @@ module Meteor
525
525
 
526
526
  private :element_normal_three_two
527
527
 
528
- def element_pattern_normal_three_two
528
+ def element_pattern_normal_three_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
529
529
  # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
530
530
  # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
531
531
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
@@ -592,7 +592,7 @@ module Meteor
592
592
  # @param [String] attr_value attribute value (属性値)
593
593
  # @return [Meteor::Element] element (要素)
594
594
  #
595
- def element_two(attr_name, attr_value)
595
+ def element_two(attr_name, attr_value) # rubocop:disable Metrics/MethodLength
596
596
  quote_attribute(attr_name, attr_value)
597
597
 
598
598
  element_pattern_two
@@ -818,7 +818,7 @@ module Meteor
818
818
  # @param [String] attr_value2 attribute value2 (属性値2)
819
819
  # @return [Meteor::Element] element (要素)
820
820
  #
821
- def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
821
+ def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
822
822
  quote_element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
823
823
 
824
824
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)\\/>|<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
@@ -881,7 +881,7 @@ module Meteor
881
881
 
882
882
  private :quote_element_five
883
883
 
884
- def element_normal_five_one(name)
884
+ def element_normal_five_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
885
885
  # puts @res.captures.length
886
886
  case @res.captures.length
887
887
  when FOUR
@@ -961,7 +961,7 @@ module Meteor
961
961
 
962
962
  private :element_normal_five_two
963
963
 
964
- def element_pattern_normal_five_two
964
+ def element_pattern_normal_five_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
965
965
  # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
966
966
  # @pattern_cc_one << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
967
967
  # @pattern_cc_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
@@ -1038,7 +1038,7 @@ module Meteor
1038
1038
  # @param [String]attr_value2 attribute value2 (属性値2)
1039
1039
  # @return [Meteor::Element] element (要素)
1040
1040
  #
1041
- def element_four(attr_name1, attr_value1, attr_name2, attr_value2)
1041
+ def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
1042
1042
  quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
1043
1043
 
1044
1044
  element_pattern_four
@@ -1084,7 +1084,7 @@ module Meteor
1084
1084
 
1085
1085
  private :element_pattern_four
1086
1086
 
1087
- def create_element_pattern
1087
+ def create_element_pattern # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1088
1088
  @position = 0
1089
1089
 
1090
1090
  while (@res = @pattern.match(@root.document, @position)) || @cnt > ZERO
@@ -1093,17 +1093,17 @@ module Meteor
1093
1093
  @position2 = @res.end(0)
1094
1094
  @res = @pattern_two.match(@root.document, @position)
1095
1095
 
1096
- if @res
1096
+ if @res # rubocop:disable Metrics/BlockNesting
1097
1097
  @position = @res.end(0)
1098
1098
 
1099
- if @position > @position2
1099
+ if @position > @position2 # rubocop:disable Metrics/BlockNesting
1100
1100
  @sbuf << @pattern_cc_one_two
1101
1101
  @cnt += 1
1102
1102
  @position = @position2
1103
1103
  else
1104
1104
  @cnt -= ONE
1105
1105
 
1106
- if @cnt != ZERO
1106
+ if @cnt != ZERO # rubocop:disable Metrics/BlockNesting
1107
1107
  @sbuf << @pattern_cc_two_one
1108
1108
  else
1109
1109
  @sbuf << @pattern_cc_two_two
@@ -1137,7 +1137,6 @@ module Meteor
1137
1137
  end
1138
1138
 
1139
1139
  @position = @res.end(0)
1140
-
1141
1140
  end
1142
1141
 
1143
1142
  @pattern = @pattern_oneb
@@ -1261,7 +1260,7 @@ module Meteor
1261
1260
  # @param [String] attr_value2 attribute value2 (属性値2)
1262
1261
  # @return [Array<Meteor::Element>] element array (要素配列)
1263
1262
  #
1264
- def elements(elm, attrs = nil, *args)
1263
+ def elements(elm, attrs = nil, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1265
1264
  if !attrs
1266
1265
  if elm.is_a?(String)
1267
1266
  elements_(elm)
@@ -1305,7 +1304,7 @@ module Meteor
1305
1304
  end
1306
1305
  end
1307
1306
 
1308
- def elements_(*args)
1307
+ def elements_(*args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1309
1308
  elm_arr = []
1310
1309
 
1311
1310
  @on_search = true
@@ -1381,7 +1380,7 @@ module Meteor
1381
1380
  # @param [String] selector selector (セレクタ)
1382
1381
  # @return [Array<Meteor::Element>] element array (要素配列)
1383
1382
  #
1384
- def find(selector)
1383
+ def find(selector) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1385
1384
  open_count = selector.count('[')
1386
1385
 
1387
1386
  case open_count
@@ -1435,7 +1434,7 @@ module Meteor
1435
1434
  # @param [String,Symbol] attr_name attribute name (属性名)
1436
1435
  # @return [String] attribute value (属性値)
1437
1436
  #
1438
- def attr(elm, attr, *args)
1437
+ def attr(elm, attr, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1439
1438
  if attr.is_a?(String) || attr.is_a?(Symbol)
1440
1439
  case args.length
1441
1440
  when ZERO
@@ -1455,7 +1454,7 @@ module Meteor
1455
1454
  else
1456
1455
  remove_attr(elm, attr.keys[0].to_s)
1457
1456
  end
1458
- # elsif attrs.kind_of?(Hash) && attrs.size >= 1
1457
+ # elsif attrs.is_a?(Hash) && attrs.size >= 1
1459
1458
  # elm.document_sync = true
1460
1459
  # attrs.each{|name,value|
1461
1460
  # set_attribute_three(elm,name,value)
@@ -1484,7 +1483,7 @@ module Meteor
1484
1483
 
1485
1484
  private :set_attribute_three
1486
1485
 
1487
- def edit_attrs_(elm, attr_name, attr_value)
1486
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1488
1487
  # attribute search (属性検索)
1489
1488
  # @res = @pattern.match(elm.attributes)
1490
1489
 
@@ -1548,7 +1547,7 @@ module Meteor
1548
1547
  # @param [Meteor::element] elm element (要素)
1549
1548
  # @return [Hash<String,String>] attribute map (要素マップ)
1550
1549
  #
1551
- def attrs(elm, *args)
1550
+ def attrs(elm, *args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1552
1551
  case args.length
1553
1552
  when ZERO
1554
1553
  get_attrs(elm)
@@ -1621,7 +1620,7 @@ module Meteor
1621
1620
  when ZERO
1622
1621
  get_attr_map(elm)
1623
1622
  when ONE
1624
- # if elm.kind_of?(Meteor::Element) && args[0].kind_of?(Meteor::AttributeMap)
1623
+ # if elm.is_a?(Meteor::Element) && args[0].is_a?(Meteor::AttributeMap)
1625
1624
  elm.document_sync = true
1626
1625
  set_attr_map(elm, args[0])
1627
1626
  # end
@@ -1689,16 +1688,16 @@ module Meteor
1689
1688
  # @param [Meteor::Element] elm element (要素)
1690
1689
  # @return [String] content (内容)
1691
1690
  #
1692
- def content(*args)
1691
+ def content(*args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1693
1692
  case args.length
1694
1693
  when ONE
1695
- # if args[0].kind_of?(Meteor::Element)
1694
+ # if args[0].is_a?(Meteor::Element)
1696
1695
  get_content_one(args[0])
1697
1696
  # else
1698
1697
  # raise ArgumentError
1699
1698
  # end
1700
1699
  when TWO
1701
- # if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String)
1700
+ # if args[0].is_a?(Meteor::Element) && args[1].is_a?(String)
1702
1701
  args[0].document_sync = true
1703
1702
  set_content_two(args[0], args[1].to_s)
1704
1703
  # else
@@ -1719,7 +1718,7 @@ module Meteor
1719
1718
  # @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
1720
1719
  # @return [Meteor::Element] element (要素)
1721
1720
  #
1722
- def set_content_three(elm, content, entity_ref = true)
1721
+ def set_content_three(elm, content, entity_ref = true) # rubocop:disable Style/OptionalBooleanParameter
1723
1722
  escape_content(content, elm) if entity_ref || !elm.raw_content
1724
1723
 
1725
1724
  elm.mixed_content = content
@@ -1824,7 +1823,7 @@ module Meteor
1824
1823
  # @param [String] id id attribute value (ID属性値)
1825
1824
  # @return [Meteor::Element] element (要素)
1826
1825
  #
1827
- def cxtag_two(name, id)
1826
+ def cxtag_two(name, id) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1828
1827
  quote_name(name)
1829
1828
  @_id = Regexp.quote(id)
1830
1829
 
@@ -1905,7 +1904,7 @@ module Meteor
1905
1904
 
1906
1905
  private :replace
1907
1906
 
1908
- def reflect
1907
+ def reflect # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1909
1908
  # puts @element_cache.size.to_s
1910
1909
  @element_cache.each_value do |item|
1911
1910
  next unless item.usable
@@ -1948,7 +1947,7 @@ module Meteor
1948
1947
  #
1949
1948
  # reflect (反映する)
1950
1949
  #
1951
- def flash
1950
+ def flash # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
1952
1951
  if element_hook
1953
1952
  if element_hook.origin.childless
1954
1953
  if element_hook.origin.cx
@@ -2022,7 +2021,7 @@ module Meteor
2022
2021
  # @param [Meteor::Element] elm element (要素)
2023
2022
  # @return [Meteor::Element] element (要素)
2024
2023
  #
2025
- def shadow(elm)
2024
+ def shadow(elm) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
2026
2025
  return unless elm.normal
2027
2026
 
2028
2027
  # case of normal element (内容あり要素の場合)
@@ -2108,7 +2107,7 @@ module Meteor
2108
2107
  private :escape
2109
2108
  private :escape_content
2110
2109
 
2111
- def unescape(content)
2110
+ def unescape(content) # rubocop:disable Metrics/MethodLength
2112
2111
  # replace special character (特殊文字の置換)
2113
2112
  # 「<」<-「&lt;」
2114
2113
  # 「>」<-「&gt;」
@@ -2116,7 +2115,7 @@ module Meteor
2116
2115
  # 「 」<-「&nbsp;」
2117
2116
  # 「&」<-「&amp;」
2118
2117
  content.gsub(RE_UNESCAPE) do
2119
- case ::Regexp.last_match(1)
2118
+ case ::Regexp.last_match(1) # rubocop:disable Style/HashLikeCase
2120
2119
  when 'amp'
2121
2120
  '&'
2122
2121
  when 'quot'
@@ -59,9 +59,9 @@ module Meteor
59
59
  # @param [Meteor::Element] elm element (要素)
60
60
  # @param [Meteor::Parser] ps parser (パーサ)
61
61
  #
62
- def initialize(*args)
62
+ def initialize(*args) # rubocop:disable Metrics/MethodLength
63
63
  case args.length
64
- when Meteor::ZERO
64
+ when Meteor::ZERO # rubocop:disable Lint/EmptyWhen
65
65
  when Meteor::ONE
66
66
  if args[0].is_a?(String)
67
67
  initialize_s(args[0])
@@ -108,7 +108,7 @@ module Meteor
108
108
 
109
109
  private :initialize_e
110
110
 
111
- def initialize_two(elm, ps)
111
+ def initialize_two(elm, ps) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Naming/MethodParameterName
112
112
  @parser = ps
113
113
  if normal
114
114
  ps.element(elm)
@@ -151,8 +151,8 @@ module Meteor
151
151
  # clone (複製する)
152
152
  # @return [Meteor::Element] element (要素)
153
153
  #
154
- def clone_zero
155
- obj = parser.element_cache[object_id]
154
+ def clone_zero # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
155
+ obj = parser.element_cache[object_id] # rubocop:disable Lint/HashCompareByIdentity
156
156
  if obj
157
157
  obj.attributes = String.new(attributes)
158
158
  obj.mixed_content = String.new(mixed_content)
@@ -161,7 +161,7 @@ module Meteor
161
161
  obj.usable = true
162
162
  else
163
163
  obj = self.class.new(self)
164
- parser.element_cache[object_id] = obj
164
+ parser.element_cache[object_id] = obj # rubocop:disable Lint/HashCompareByIdentity
165
165
  end
166
166
  obj
167
167
  end
@@ -173,7 +173,7 @@ module Meteor
173
173
  # @param [Meteor::Parser] ps parser (パーサ)
174
174
  # @return [Meteor::Element] element (要素)
175
175
  #
176
- def clone_one(ps)
176
+ def clone_one(ps) # rubocop:disable Naming/MethodParameterName
177
177
  obj = ps.element_hook
178
178
  if obj
179
179
  obj.attributes = String.new(attributes)
@@ -202,7 +202,7 @@ module Meteor
202
202
  # get document (ドキュメントを取得する)
203
203
  # @return [String] document (ドキュメント)
204
204
  #
205
- def document
205
+ def document # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
206
206
  if @document_sync
207
207
  @document_sync = false
208
208
  case @parser.doc_type
@@ -35,7 +35,7 @@ module Meteor
35
35
  # @param [String,Symbol] attr_name2 attribute name2 (属性名2)
36
36
  # @param [String] attr_value2 attribute value2 (属性値2)
37
37
  #
38
- def initialize(*args)
38
+ def initialize(*args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
39
39
  case args.length
40
40
  when ONE
41
41
  initialize_one(args[0])
@@ -52,7 +52,7 @@ module Meteor
52
52
  # initializer (イニシャライザ)
53
53
  # @overload initialize
54
54
  # @overload initialize(ps)
55
- # @param [Meteor::Parser] ps paser (パーサ)
55
+ # @param [Meteor::Parser] ps parser (パーサ)
56
56
  #
57
57
  def initialize(*args)
58
58
  super()
@@ -79,7 +79,7 @@ module Meteor
79
79
  # initializer (イニシャライザ)
80
80
  # @param [Meteor::Parser] ps parser (パーサ)
81
81
  #
82
- def initialize_one(ps)
82
+ def initialize_one(ps) # rubocop:disable Naming/MethodParameterName
83
83
  @root.document = String.new(ps.document)
84
84
  self.document_hook = String.new(ps.document_hook)
85
85
  @root.content_type = String.new(ps.root_element.content_type)
@@ -111,7 +111,7 @@ module Meteor
111
111
 
112
112
  private :analyze_content_type
113
113
 
114
- def edit_attrs_(elm, attr_name, attr_value)
114
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
115
115
  if match?('selected', attr_name) && match?('option', elm.name)
116
116
  edit_attrs_five(elm, attr_name, attr_value, RE_SELECTED_M, RE_SELECTED_R)
117
117
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -133,7 +133,7 @@ module Meteor
133
133
 
134
134
  private :edit_attrs_
135
135
 
136
- def get_attr_value_(elm, attr_name)
136
+ def get_attr_value_(elm, attr_name) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
137
137
  if match?('selected', attr_name) && match?('option', elm.name)
138
138
  get_attr_value_r(elm, RE_SELECTED_M)
139
139
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -105,9 +105,9 @@ module Meteor
105
105
 
106
106
  #
107
107
  # initializer (イニシャライザ)
108
- # @param [Meteor::Parser] ps paser (パーサ)
108
+ # @param [Meteor::Parser] ps parser (パーサ)
109
109
  #
110
- def initialize_one(ps)
110
+ def initialize_one(ps) # rubocop:disable Naming/MethodParameterName
111
111
  @root.document = String.new(ps.document)
112
112
  self.document_hook = String.new(ps.document_hook)
113
113
  @root.content_type = String.new(ps.root_element.content_type)
@@ -149,7 +149,7 @@ module Meteor
149
149
  #
150
150
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
151
151
  #
152
- def analyze_content_type
152
+ def analyze_content_type # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
153
153
  @error_check = false
154
154
 
155
155
  element_three('meta', 'http-equiv', 'Content-Type')
@@ -184,7 +184,7 @@ module Meteor
184
184
  # @param [String] name tag name (タグ名)
185
185
  # @return [Meteor::Element] element (要素)
186
186
  #
187
- def element_one(name)
187
+ def element_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
188
188
  quote_name(name)
189
189
 
190
190
  # case of void element (空要素の場合(<->内容あり要素の場合))
@@ -248,7 +248,7 @@ module Meteor
248
248
  # @param [true,false] quote quote flag (クオート・フラグ)
249
249
  # @return [Meteor::Element] element (要素)
250
250
  #
251
- def element_three(name, attr_name, attr_value, quote = true)
251
+ def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
252
252
  if quote
253
253
  quote_element_three(name, attr_name, attr_value)
254
254
  else
@@ -311,7 +311,7 @@ module Meteor
311
311
  # @param [String] attr_value attribute value (属性値)
312
312
  # @return [Meteor::Element] element (要素)
313
313
  #
314
- def element_two(attr_name, attr_value)
314
+ def element_two(attr_name, attr_value) # rubocop:disable Metrics/MethodLength
315
315
  quote_attribute(attr_name, attr_value)
316
316
 
317
317
  # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value
@@ -343,7 +343,7 @@ module Meteor
343
343
  # @param [String] attr_value2 attribute value2 (属性値2)
344
344
  # @return [Meteor::Element] element (要素)
345
345
  #
346
- def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
346
+ def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
347
347
  quote_element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
348
348
 
349
349
  # case of void element (空要素の場合(<->内容あり要素の場合))
@@ -424,7 +424,7 @@ module Meteor
424
424
  # @param [String] attr_value2 attribute value2 (属性値2)
425
425
  # @return [Meteor::Element] element (要素)
426
426
  #
427
- def element_four(attr_name1, attr_value1, attr_name2, attr_value2)
427
+ def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
428
428
  quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
429
429
 
430
430
  # @pattern_cc = String.new('') << '<([^<>"]*)\\s([^<>]*(' << @_attr_name1 << '="' << @_attr_value1
@@ -455,7 +455,7 @@ module Meteor
455
455
 
456
456
  private :element_four
457
457
 
458
- def edit_attrs_(elm, attr_name, attr_value)
458
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
459
459
  if match?('selected', attr_name) && match?('option', elm.name)
460
460
  edit_attrs_five(elm, attr_name, attr_value, RE_SELECTED_M, RE_SELECTED_R)
461
461
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -475,7 +475,7 @@ module Meteor
475
475
 
476
476
  private :edit_attrs_
477
477
 
478
- def edit_attrs_five(elm, attr_name, attr_value, match_p, replace)
478
+ def edit_attrs_five(elm, attr_name, attr_value, match_p, replace) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
479
479
  if true.equal?(attr_value) || match?('true', attr_value)
480
480
  @res = match_p.match(elm.attributes)
481
481
 
@@ -502,7 +502,7 @@ module Meteor
502
502
 
503
503
  private :edit_document_one
504
504
 
505
- def get_attr_value_(elm, attr_name)
505
+ def get_attr_value_(elm, attr_name) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
506
506
  if match?('selected', attr_name) && match?('option', elm.name)
507
507
  get_attr_value_r(elm, RE_SELECTED_M)
508
508
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -57,7 +57,7 @@ module Meteor
57
57
  # initializer (イニシャライザ)
58
58
  # @param [Meteor::Parser] ps parser (パーサ)
59
59
  #
60
- def initialize_one(ps)
60
+ def initialize_one(ps) # rubocop:disable Naming/MethodParameterName
61
61
  @root.document = String.new(ps.document)
62
62
  self.document_hook = String.new(ps.document_hook)
63
63
  @root.content_type = String.new(ps.root_element.content_type)
@@ -89,7 +89,7 @@ module Meteor
89
89
 
90
90
  private :analyze_content_type
91
91
 
92
- def edit_attrs_(elm, attr_name, attr_value)
92
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
93
93
  if match?('selected', attr_name) && match?('option', elm.name)
94
94
  edit_attrs_five(elm, attr_value, RE_SELECTED_M, RE_SELECTED_R, SELECTED_U)
95
95
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -111,7 +111,7 @@ module Meteor
111
111
 
112
112
  private :edit_attrs_
113
113
 
114
- def get_attr_value_(elm, attr_name)
114
+ def get_attr_value_(elm, attr_name) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
115
115
  if match?('selected', attr_name) && match?('option', elm.name)
116
116
  get_attr_value_r(elm, attr_name, RE_SELECTED_M1)
117
117
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -98,7 +98,7 @@ module Meteor
98
98
  # initializer (イニシャライザ)
99
99
  # @param [Meteor::Parser] ps parser (パーサ)
100
100
  #
101
- def initialize_one(ps)
101
+ def initialize_one(ps) # rubocop:disable Naming/MethodParameterName
102
102
  @root.document = String.new(ps.document)
103
103
  self.document_hook = String.new(ps.document_hook)
104
104
  @root.content_type = String.new(ps.root_element.content_type)
@@ -139,7 +139,7 @@ module Meteor
139
139
  #
140
140
  # analyze document , set content type (ドキュメントをパースし、コンテントタイプをセットする)
141
141
  #
142
- def analyze_content_type
142
+ def analyze_content_type # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
143
143
  @error_check = false
144
144
 
145
145
  element_three('meta', 'http-equiv', 'Content-Type')
@@ -171,7 +171,7 @@ module Meteor
171
171
 
172
172
  private :analyze_newline
173
173
 
174
- def edit_attrs_(elm, attr_name, attr_value)
174
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
175
175
  if match?('selected', attr_name) && match?('option', elm.name)
176
176
  edit_attrs_five(elm, attr_value, RE_SELECTED_M, RE_SELECTED_R, SELECTED_U)
177
177
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -191,7 +191,7 @@ module Meteor
191
191
 
192
192
  private :edit_attrs_
193
193
 
194
- def edit_attrs_five(elm, attr_value, match_p, replace_regex, replace_update)
194
+ def edit_attrs_five(elm, attr_value, match_p, replace_regex, replace_update) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
195
195
  # attr_value = escape(attr_value)
196
196
 
197
197
  if true.equal?(attr_value) || match?('true', attr_value)
@@ -218,7 +218,7 @@ module Meteor
218
218
 
219
219
  private :edit_attrs_five
220
220
 
221
- def get_attr_value_(elm, attr_name)
221
+ def get_attr_value_(elm, attr_name) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
222
222
  if match?('selected', attr_name) && match?('option', elm.name)
223
223
  get_attr_value_r(elm, attr_name, RE_SELECTED_M1)
224
224
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -249,7 +249,7 @@ module Meteor
249
249
 
250
250
  private :get_type
251
251
 
252
- def get_attr_value_r(elm, attr_name, match_p)
252
+ def get_attr_value_r(elm, attr_name, match_p) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
253
253
  @res = match_p.match(elm.attributes)
254
254
 
255
255
  if @res
@@ -57,7 +57,7 @@ module Meteor
57
57
  # initializer (イニシャライザ)
58
58
  # @param [Meteor::Parser] ps parser (パーサ)
59
59
  #
60
- def initialize_one(ps)
60
+ def initialize_one(ps) # rubocop:disable Naming/MethodParameterName
61
61
  @root.document = String.new(ps.document)
62
62
  ps.document_hook = String.new(ps.document_hook)
63
63
  @root.content_type = String.new(ps.root_element.content_type)
@@ -128,7 +128,7 @@ module Meteor
128
128
 
129
129
  private :escape_content
130
130
 
131
- def unescape(content)
131
+ def unescape(content) # rubocop:disable Metrics/MethodLength
132
132
  # replace special character (特殊文字の置換)
133
133
  # 「<」<-「&lt;」
134
134
  # 「>」<-「&gt;」
@@ -136,7 +136,7 @@ module Meteor
136
136
  # 「'」<-「&apos;」
137
137
  # 「&」<-「&amp;」
138
138
  content.gsub(RE_UNESCAPE) do
139
- case ::Regexp.last_match(1)
139
+ case ::Regexp.last_match(1) # rubocop:disable Style/HashLikeCase
140
140
  when 'amp'
141
141
  '&'
142
142
  when 'quot'
@@ -12,7 +12,7 @@ module Meteor
12
12
  # @!attribute [rw] enc
13
13
  # @return [String] default character encoding (デフォルトエンコーディング)
14
14
  #
15
- class Parsers
15
+ class Parsers # rubocop:disable Metrics/ClassLength
16
16
  attr_accessor :type, :root, :enc
17
17
 
18
18
  alias base_type type
@@ -38,7 +38,7 @@ module Meteor
38
38
  # @param [String] root root directory (基準ディレクトリ)
39
39
  # @param [String] enc default character encoding (デフォルト文字エンコーディング)
40
40
  #
41
- def initialize(*args)
41
+ def initialize(*args) # rubocop:disable Metrics/MethodLength
42
42
  case args.length
43
43
  when 0
44
44
  initialize_zero
@@ -110,7 +110,7 @@ module Meteor
110
110
  # @option opts [Integer,Symbol] :type default type of parser (デフォルトのパーサ・タイプ)
111
111
  # @option @deprecated opts [Integer | Symbol] :base_type default type of parser (デフォルトのパーサ・タイプ)
112
112
  #
113
- def options=(opts)
113
+ def options=(opts) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
114
114
  raise ArgumentError unless opts.is_a?(Hash)
115
115
 
116
116
  if opts.include?(:root)
@@ -154,7 +154,7 @@ module Meteor
154
154
  # @param [String] relative_path relative file path (相対ファイルパス)
155
155
  # @return [Meteor::Parser] parser (パーサ)
156
156
  #
157
- def add(*args)
157
+ def add(*args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
158
158
  case args.length
159
159
  when 1
160
160
  add_file_one(args[0])
@@ -180,7 +180,7 @@ module Meteor
180
180
  # @param [String] path relative path (相対パス)
181
181
  # @return [String] relative url (相対URL)
182
182
  #
183
- def path_to_url(path)
183
+ def path_to_url(path) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
184
184
  paths = File.split(path)
185
185
 
186
186
  if paths.length == 1
@@ -339,18 +339,7 @@ module Meteor
339
339
  #
340
340
  def parser_one(key)
341
341
  @pif = @cache[key.to_s]
342
- case @pif.doc_type
343
- when Meteor::Parser::HTML
344
- Meteor::Ml::Html::ParserImpl.new(@pif)
345
- when Meteor::Parser::XML
346
- Meteor::Ml::Xml::ParserImpl.new(@pif)
347
- when Meteor::Parser::XHTML
348
- Meteor::Ml::Xhtml::ParserImpl.new(@pif)
349
- when Meteor::Parser::HTML4
350
- Meteor::Ml::Html4::ParserImpl.new(@pif)
351
- when Meteor::Parser::XHTML4
352
- Meteor::Ml::Xhtml4::ParserImpl.new(@pif)
353
- end
342
+ new_parser(@pif)
354
343
  end
355
344
 
356
345
  private :parser_one
@@ -364,7 +353,17 @@ module Meteor
364
353
  parser_one(key).root_element
365
354
  end
366
355
 
367
- def new_parser(type)
356
+ def new_parser(val)
357
+ if val.is_a?(Integer) || val.is_a?(Symbol)
358
+ new_parser_type(val)
359
+ elsif val.is_a?(Meteor::Core::Kernel)
360
+ new_parser_ps(val)
361
+ end
362
+ end
363
+
364
+ private :new_parser
365
+
366
+ def new_parser_type(type) # rubocop:disable Metrics/MethodLength
368
367
  case type
369
368
  when Parser::HTML, :html
370
369
  Meteor::Ml::Html::ParserImpl.new
@@ -381,14 +380,31 @@ module Meteor
381
380
  end
382
381
  end
383
382
 
384
- private :new_parser
383
+ private :new_parser_type
384
+
385
+ def new_parser_ps(pif) # rubocop:disable Metrics/MethodLength
386
+ case pif.doc_type
387
+ when Meteor::Parser::HTML
388
+ Meteor::Ml::Html::ParserImpl.new(pif)
389
+ when Meteor::Parser::XML
390
+ Meteor::Ml::Xml::ParserImpl.new(pif)
391
+ when Meteor::Parser::XHTML
392
+ Meteor::Ml::Xhtml::ParserImpl.new(pif)
393
+ when Meteor::Parser::HTML4
394
+ Meteor::Ml::Html4::ParserImpl.new(pif)
395
+ when Meteor::Parser::XHTML4
396
+ Meteor::Ml::Xhtml4::ParserImpl.new(pif)
397
+ end
398
+ end
399
+
400
+ private :new_parser_ps
385
401
 
386
402
  #
387
403
  # set parser (パーサをセットする)
388
404
  # @param [String,Symbol] key identifier (キー)
389
405
  # @param [Meteor::Parser] ps parser (パーサ)
390
406
  #
391
- def []=(key, ps)
407
+ def []=(key, ps) # rubocop:disable Naming/MethodParameterName
392
408
  @cache[key] = ps
393
409
  end
394
410
 
data/lib/meteor.rb CHANGED
@@ -37,11 +37,11 @@ require 'meteor/ml/xml/parser_impl'
37
37
  # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38
38
  #
39
39
  # @author Yasumasa Ashida
40
- # @version 0.9.38
40
+ # @version 0.9.40
41
41
  #
42
42
 
43
43
  module Meteor
44
- VERSION = '0.9.38'
44
+ VERSION = '0.9.40'
45
45
 
46
46
  # require 'fileutils'
47
47
 
data/meteor.gemspec CHANGED
@@ -22,6 +22,6 @@ Gem::Specification.new do |spec|
22
22
  spec.test_files = spec.files.grep(%r{^(test|spec|features|demo)/})
23
23
  spec.require_paths = ['lib']
24
24
 
25
- spec.add_development_dependency 'bundler', '~> 4.0.13'
25
+ spec.add_development_dependency 'bundler', '~> 4.0.15'
26
26
  # spec.add_development_dependency "rake"
27
27
  end
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.38
4
+ version: 0.9.40
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida
@@ -15,14 +15,14 @@ dependencies:
15
15
  requirements:
16
16
  - - "~>"
17
17
  - !ruby/object:Gem::Version
18
- version: 4.0.13
18
+ version: 4.0.15
19
19
  type: :development
20
20
  prerelease: false
21
21
  version_requirements: !ruby/object:Gem::Requirement
22
22
  requirements:
23
23
  - - "~>"
24
24
  - !ruby/object:Gem::Version
25
- version: 4.0.13
25
+ version: 4.0.15
26
26
  description: A lightweight (X)HTML & XML parser
27
27
  email: ys.ashida@gmail.com
28
28
  executables: []