meteor 0.9.39 → 0.9.41

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: 8c2662781c5b67592210d563d198cb97f845e490782d09ad48d90d5f78b4a687
4
- data.tar.gz: 4b351ff296228212f69749c5fd759f60cd7e680b6912c02c8b165bb8d821febf
3
+ metadata.gz: 46eb97e00adae645d7675426b601a1f1d90ef372aad0c4106d169b86bbb72b46
4
+ data.tar.gz: efa01e2a273c17a070986389581b032cbfc1cd64e47164cf247f675fcdde5554
5
5
  SHA512:
6
- metadata.gz: ab9dd8444e3366acfe6ae67d07da1d41d771f7da7c5f0fa821763eb52f0e3deb84037c4f68270a6f3a9020f04c9c44d869bbac50ac8b164a19f225ba60b9d17d
7
- data.tar.gz: 02c05a7d823e1fc36e8d1561f2c91aa51ae725f45647ef1742479d7c52bfc748226778d9340e794d14b4c4ec82425732b01b98babdac729a9626b0bfa35bf419
6
+ metadata.gz: d7d915e4808fe38ce59fb1d127b534cb18a2c1c627742031185bb20f6ba32aeb67dec856dfdb042854ce9a0b6775111191ea2c031463a2cf8c7f75f2cf6a3de9
7
+ data.tar.gz: 9a030a41653d7c0c69ad35c37355ef8acfdd406f7679e36c7fcf7d039326c21b32e86ed9ed173b588d37c430e776c9647c0aff253361ce97344f17b128da65bd
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.41 / 2026-07-14 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Remove unnecessary comments
4
+
5
+ == 0.9.40 / 2026-07-13 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Fix comments
8
+
1
9
  == 0.9.39 / 2026-07-09 Yasumasa Ashida <ys.ashida@gmail.com>
2
10
 
3
11
  * Refactor Meteor::Parsers
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.39)
4
+ meteor (0.9.41)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -41,9 +41,9 @@ PLATFORMS
41
41
  ruby
42
42
 
43
43
  DEPENDENCIES
44
- bundler (~> 4.0.15)
44
+ bundler (~> 4.0.16)
45
45
  meteor!
46
46
  rubocop (~> 1.88.2)
47
47
 
48
48
  BUNDLED WITH
49
- 4.0.15
49
+ 4.0.16
@@ -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
@@ -330,8 +330,6 @@ module Meteor
330
330
  end
331
331
  @elm_.document = @res[0]
332
332
  # normal element search pattern (内容あり要素検索用パターン)
333
- # @pattern_cc = String.new('') << "<" << @_name << '(?:|\\s[^<>]*)>((?!(' << @_name
334
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
335
333
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
336
334
 
337
335
  @elm_.pattern = @pattern_cc
@@ -371,7 +369,7 @@ module Meteor
371
369
  # @param [String] attr_value attribute value (属性値)
372
370
  # @param [true,false] quote flag (クオート・フラグ)
373
371
  # @return [Meteor::Element] element (要素)
374
- def element_three(name, attr_name, attr_value, quote = true)
372
+ def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
375
373
  if quote
376
374
  quote_element_three(name, attr_name, attr_value)
377
375
  else
@@ -441,7 +439,7 @@ module Meteor
441
439
 
442
440
  private :quote_element_three
443
441
 
444
- def element_normal_three_one(name)
442
+ def element_normal_three_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
445
443
  # puts @res.captures.length
446
444
  case @res.captures.length
447
445
  when FOUR
@@ -454,9 +452,6 @@ module Meteor
454
452
  # document (全体)
455
453
  @elm_.document = @res[0]
456
454
  # normal element search pattern (内容あり要素検索用パターン)
457
- # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
458
- # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
459
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
460
455
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
461
456
 
462
457
  @elm_.pattern = @pattern_cc
@@ -474,9 +469,6 @@ module Meteor
474
469
  # document (全体)
475
470
  @elm_.document = @res[0]
476
471
  # normal element search pattern (内容あり要素検索用パターン)
477
- # @pattern_cc = String.new('')<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
478
- # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
479
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
480
472
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
481
473
 
482
474
  @elm_.pattern = @pattern_cc
@@ -525,14 +517,10 @@ module Meteor
525
517
 
526
518
  private :element_normal_three_two
527
519
 
528
- def element_pattern_normal_three_two
529
- # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
530
- # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
520
+ def element_pattern_normal_three_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
531
521
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
532
522
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
533
523
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
534
- # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
535
- # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
536
524
  @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
537
525
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
538
526
  # @pattern_cc_one_two = ".*?<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
@@ -575,8 +563,6 @@ module Meteor
575
563
  # document (全体)
576
564
  @elm_.document = @res[0]
577
565
  # pattern (空要素検索用パターン)
578
- # @pattern_cc = String.new("") << "<" << @_name << "(\\s[^<>]*"
579
- # << @_attr_name << "=\"" << @_attr_value << closer
580
566
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}#{closer}"
581
567
  @elm_.pattern = @pattern_cc
582
568
  @elm_.parser = self
@@ -592,7 +578,7 @@ module Meteor
592
578
  # @param [String] attr_value attribute value (属性値)
593
579
  # @return [Meteor::Element] element (要素)
594
580
  #
595
- def element_two(attr_name, attr_value)
581
+ def element_two(attr_name, attr_value) # rubocop:disable Metrics/MethodLength
596
582
  quote_attribute(attr_name, attr_value)
597
583
 
598
584
  element_pattern_two
@@ -673,10 +659,8 @@ module Meteor
673
659
  private :quote_attribute
674
660
 
675
661
  def element_pattern_two
676
- # # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
677
- # << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
678
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
679
- # << @_attr_name << '="' << @_attr_value << '"'
662
+ ## @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*'
663
+ ## << @_attr_name << '="' << @_attr_value << '(?:[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
680
664
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\""
681
665
  end
682
666
 
@@ -696,9 +680,6 @@ module Meteor
696
680
  # # document (全体)
697
681
  # @elm_.document = @res[0]
698
682
  # # pattern (内容あり要素検索用パターン)
699
- # # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
700
- # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
701
- # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
702
683
  # @ pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
703
684
  #
704
685
  # @elm_.pattern = @pattern_cc
@@ -715,9 +696,6 @@ module Meteor
715
696
  # # document (全体)
716
697
  # @elm_.document = @res[0]
717
698
  # # pattern (内容あり要素検索用パターン)
718
- # # @pattern_cc = String.new()<< "<" << @_name << '\\s[^<>]*' << @_attr_name << '="'
719
- # # @pattern_cc << @_attr_value << '"[^<>]*>((?!(' << @_name
720
- # # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
721
699
  # @pattern_cc = "<#{@_name}\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>((?!(#{@_name}[^<>]*>)).)*<\\/#{@_name}>" # rubocop:disable Layout/LineLength
722
700
  #
723
701
  # @elm_.pattern = @pattern_cc
@@ -747,8 +725,6 @@ module Meteor
747
725
  # private :element_normal_two_one
748
726
  #
749
727
  # def element_normal_two_two
750
- # # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
751
- # # @pattern_cc_one << @_attr_value << '(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))'
752
728
  # @pattern_cc_one = "<([^<>\"]*)(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}(?:[^<>\\/]*>|(?:(?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
753
729
  #
754
730
  # # search of normal element (内容あり要素検索)
@@ -774,8 +750,6 @@ module Meteor
774
750
  # def create_pattern_two(args_cnt)
775
751
  # @pattern_cc_oneb = String.new('') << "<" << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
776
752
  #
777
- # # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
778
- # # @pattern_cc_one_one << @_attr_value << '"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
779
753
  # @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
780
754
  # @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
781
755
  # @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
@@ -818,7 +792,7 @@ module Meteor
818
792
  # @param [String] attr_value2 attribute value2 (属性値2)
819
793
  # @return [Meteor::Element] element (要素)
820
794
  #
821
- def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
795
+ def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
822
796
  quote_element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
823
797
 
824
798
  @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 +855,7 @@ module Meteor
881
855
 
882
856
  private :quote_element_five
883
857
 
884
- def element_normal_five_one(name)
858
+ def element_normal_five_one(name) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
885
859
  # puts @res.captures.length
886
860
  case @res.captures.length
887
861
  when FOUR
@@ -894,12 +868,6 @@ module Meteor
894
868
  # document (全体)
895
869
  @elm_.document = @res[0]
896
870
  # pattern (内容あり要素検索用パターン)
897
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
898
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
899
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
900
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
901
- # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
902
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
903
871
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
904
872
 
905
873
  @elm_.pattern = @pattern_cc
@@ -915,12 +883,6 @@ module Meteor
915
883
  # documement (全体)
916
884
  @elm_.document = @res[0]
917
885
  # pattern (内容あり要素検索用パターン)
918
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
919
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
920
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
921
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
922
- # @pattern_cc << @_attr_value1 << '")[^<>]*>((?!(' << @_name
923
- # @pattern_cc << '[^<>]*>)).)*<\\/' << @_name << '>'
924
886
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
925
887
 
926
888
  @elm_.pattern = @pattern_cc
@@ -961,21 +923,11 @@ module Meteor
961
923
 
962
924
  private :element_normal_five_two
963
925
 
964
- def element_pattern_normal_five_two
965
- # @pattern_cc_one = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
966
- # @pattern_cc_one << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
967
- # @pattern_cc_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
968
- # @pattern_cc_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
969
- # @pattern_cc_one << @_attr_value1 << '")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))'
926
+ def element_pattern_normal_five_two # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
970
927
  @pattern_cc_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")([^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>)))" # rubocop:disable Layout/LineLength
971
928
  @pattern_cc_oneb = String.new('') << '<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
972
929
  # @pattern_cc_oneb = "<#{@_name}(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))"
973
930
 
974
- # @pattern_cc_one_one = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
975
- # @pattern_cc_one_one << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
976
- # @pattern_cc_one_one << @_attr_value2 << '"|' << @_attr_name2 << '="'
977
- # @pattern_cc_one_one << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
978
- # @pattern_cc_one_one << @_attr_value1 << '")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))('
979
931
  @pattern_cc_one_one = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")(?:[^<>\\/]*>|(?!([^<>]*\\/>))[^<>]*>))(" # rubocop:disable Layout/LineLength
980
932
  @pattern_cc_one_two = String.new('') << '.*?<' << @_name << '(\\s[^<>\\/]*>|((?!([^<>]*\\/>))[^<>]*>))'
981
933
  @pattern_cc_two = String.new('') << '<\\/' << @_name << '>'
@@ -1016,11 +968,6 @@ module Meteor
1016
968
  # document (全体)
1017
969
  @elm_.document = @res[0]
1018
970
  # pattern (空要素検索用パターン)
1019
- # @pattern_cc = String.new('') << "<" << @_name << '\\s[^<>]*(?:' << @_attr_name1 << '="'
1020
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
1021
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1022
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1023
- # @pattern_cc << @_attr_value1 << closer
1024
971
  @pattern_cc = "<#{@_name}(\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}#{closer}" # rubocop:disable Layout/LineLength
1025
972
  @elm_.pattern = @pattern_cc
1026
973
  @elm_.parser = self
@@ -1038,7 +985,7 @@ module Meteor
1038
985
  # @param [String]attr_value2 attribute value2 (属性値2)
1039
986
  # @return [Meteor::Element] element (要素)
1040
987
  #
1041
- def element_four(attr_name1, attr_value1, attr_name2, attr_value2)
988
+ def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
1042
989
  quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
1043
990
 
1044
991
  element_pattern_four
@@ -1074,17 +1021,12 @@ module Meteor
1074
1021
  private :quote_element_four
1075
1022
 
1076
1023
  def element_pattern_four
1077
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s([^<>]*(' << @_attr_name1 << '="'
1078
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
1079
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
1080
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
1081
- # @pattern_cc << @_attr_value1 << '"'
1082
1024
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")" # rubocop:disable Layout/LineLength
1083
1025
  end
1084
1026
 
1085
1027
  private :element_pattern_four
1086
1028
 
1087
- def create_element_pattern
1029
+ def create_element_pattern # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1088
1030
  @position = 0
1089
1031
 
1090
1032
  while (@res = @pattern.match(@root.document, @position)) || @cnt > ZERO
@@ -1093,17 +1035,17 @@ module Meteor
1093
1035
  @position2 = @res.end(0)
1094
1036
  @res = @pattern_two.match(@root.document, @position)
1095
1037
 
1096
- if @res
1038
+ if @res # rubocop:disable Metrics/BlockNesting
1097
1039
  @position = @res.end(0)
1098
1040
 
1099
- if @position > @position2
1041
+ if @position > @position2 # rubocop:disable Metrics/BlockNesting
1100
1042
  @sbuf << @pattern_cc_one_two
1101
1043
  @cnt += 1
1102
1044
  @position = @position2
1103
1045
  else
1104
1046
  @cnt -= ONE
1105
1047
 
1106
- if @cnt != ZERO
1048
+ if @cnt != ZERO # rubocop:disable Metrics/BlockNesting
1107
1049
  @sbuf << @pattern_cc_two_one
1108
1050
  else
1109
1051
  @sbuf << @pattern_cc_two_two
@@ -1137,7 +1079,6 @@ module Meteor
1137
1079
  end
1138
1080
 
1139
1081
  @position = @res.end(0)
1140
-
1141
1082
  end
1142
1083
 
1143
1084
  @pattern = @pattern_oneb
@@ -1261,7 +1202,7 @@ module Meteor
1261
1202
  # @param [String] attr_value2 attribute value2 (属性値2)
1262
1203
  # @return [Array<Meteor::Element>] element array (要素配列)
1263
1204
  #
1264
- def elements(elm, attrs = nil, *args)
1205
+ def elements(elm, attrs = nil, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1265
1206
  if !attrs
1266
1207
  if elm.is_a?(String)
1267
1208
  elements_(elm)
@@ -1305,7 +1246,7 @@ module Meteor
1305
1246
  end
1306
1247
  end
1307
1248
 
1308
- def elements_(*args)
1249
+ def elements_(*args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1309
1250
  elm_arr = []
1310
1251
 
1311
1252
  @on_search = true
@@ -1381,7 +1322,7 @@ module Meteor
1381
1322
  # @param [String] selector selector (セレクタ)
1382
1323
  # @return [Array<Meteor::Element>] element array (要素配列)
1383
1324
  #
1384
- def find(selector)
1325
+ def find(selector) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1385
1326
  open_count = selector.count('[')
1386
1327
 
1387
1328
  case open_count
@@ -1435,7 +1376,7 @@ module Meteor
1435
1376
  # @param [String,Symbol] attr_name attribute name (属性名)
1436
1377
  # @return [String] attribute value (属性値)
1437
1378
  #
1438
- def attr(elm, attr, *args)
1379
+ def attr(elm, attr, *args) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
1439
1380
  if attr.is_a?(String) || attr.is_a?(Symbol)
1440
1381
  case args.length
1441
1382
  when ZERO
@@ -1455,7 +1396,7 @@ module Meteor
1455
1396
  else
1456
1397
  remove_attr(elm, attr.keys[0].to_s)
1457
1398
  end
1458
- # elsif attrs.kind_of?(Hash) && attrs.size >= 1
1399
+ # elsif attrs.is_a?(Hash) && attrs.size >= 1
1459
1400
  # elm.document_sync = true
1460
1401
  # attrs.each{|name,value|
1461
1402
  # set_attribute_three(elm,name,value)
@@ -1484,7 +1425,7 @@ module Meteor
1484
1425
 
1485
1426
  private :set_attribute_three
1486
1427
 
1487
- def edit_attrs_(elm, attr_name, attr_value)
1428
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1488
1429
  # attribute search (属性検索)
1489
1430
  # @res = @pattern.match(elm.attributes)
1490
1431
 
@@ -1496,8 +1437,8 @@ module Meteor
1496
1437
  @pattern = Meteor::Core::Util::PatternCache.get(String.new('') << attr_name << '="[^"]*"')
1497
1438
  # @pattern = Meteor::Core::Util::PatternCache.get("#{attr_name}=\"[^\"]*\"")
1498
1439
 
1440
+ # elm.attributes.sub!(@pattern, "#{attr_name}=\"#{@_attr_value}\"")
1499
1441
  elm.attributes.sub!(@pattern, String.new('') << attr_name << '="' << @_attr_value << '"')
1500
- # elm.attributes.sub!(@pattern, "#{attr_name}=\"#{@_attr_value}\"")
1501
1442
  else
1502
1443
  # add an attribute to attrubutes (属性文字列の最後に新規の属性を追加する)
1503
1444
 
@@ -1548,7 +1489,7 @@ module Meteor
1548
1489
  # @param [Meteor::element] elm element (要素)
1549
1490
  # @return [Hash<String,String>] attribute map (要素マップ)
1550
1491
  #
1551
- def attrs(elm, *args)
1492
+ def attrs(elm, *args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1552
1493
  case args.length
1553
1494
  when ZERO
1554
1495
  get_attrs(elm)
@@ -1621,7 +1562,7 @@ module Meteor
1621
1562
  when ZERO
1622
1563
  get_attr_map(elm)
1623
1564
  when ONE
1624
- # if elm.kind_of?(Meteor::Element) && args[0].kind_of?(Meteor::AttributeMap)
1565
+ # if elm.is_a?(Meteor::Element) && args[0].is_a?(Meteor::AttributeMap)
1625
1566
  elm.document_sync = true
1626
1567
  set_attr_map(elm, args[0])
1627
1568
  # end
@@ -1689,16 +1630,16 @@ module Meteor
1689
1630
  # @param [Meteor::Element] elm element (要素)
1690
1631
  # @return [String] content (内容)
1691
1632
  #
1692
- def content(*args)
1633
+ def content(*args) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1693
1634
  case args.length
1694
1635
  when ONE
1695
- # if args[0].kind_of?(Meteor::Element)
1636
+ # if args[0].is_a?(Meteor::Element)
1696
1637
  get_content_one(args[0])
1697
1638
  # else
1698
1639
  # raise ArgumentError
1699
1640
  # end
1700
1641
  when TWO
1701
- # if args[0].kind_of?(Meteor::Element) && args[1].kind_of?(String)
1642
+ # if args[0].is_a?(Meteor::Element) && args[1].is_a?(String)
1702
1643
  args[0].document_sync = true
1703
1644
  set_content_two(args[0], args[1].to_s)
1704
1645
  # else
@@ -1719,7 +1660,7 @@ module Meteor
1719
1660
  # @param [true,false] entity_ref entity reference flag (エンティティ参照フラグ)
1720
1661
  # @return [Meteor::Element] element (要素)
1721
1662
  #
1722
- def set_content_three(elm, content, entity_ref = true)
1663
+ def set_content_three(elm, content, entity_ref = true) # rubocop:disable Style/OptionalBooleanParameter
1723
1664
  escape_content(content, elm) if entity_ref || !elm.raw_content
1724
1665
 
1725
1666
  elm.mixed_content = content
@@ -1824,13 +1765,11 @@ module Meteor
1824
1765
  # @param [String] id id attribute value (ID属性値)
1825
1766
  # @return [Meteor::Element] element (要素)
1826
1767
  #
1827
- def cxtag_two(name, id)
1768
+ def cxtag_two(name, id) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1828
1769
  quote_name(name)
1829
1770
  @_id = Regexp.quote(id)
1830
1771
 
1831
1772
  # CX tag search pattern (CXタグ検索用パターン)
1832
- # @pattern_cc = String.new('') << "<!--\\s@" << @_name << '\\s([^<>]*id="'
1833
- # @pattern_cc << id << '"[^<>]*)-->(((?!(<!--\\s/@' << @_name << ")).)*)<!--\\s/@" << @_name << "\\s-->"
1834
1773
  # @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s\\/@#{@_name})).)*)<!--\\s\\/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1835
1774
  @pattern_cc = "<!--\\s@#{@_name}\\s([^<>]*id=\"#{@_id}\"[^<>]*)-->(((?!(<!--\\s/@#{@_name})).)*)<!--\\s/@#{@_name}\\s-->" # rubocop:disable Layout/LineLength
1836
1775
 
@@ -1905,7 +1844,7 @@ module Meteor
1905
1844
 
1906
1845
  private :replace
1907
1846
 
1908
- def reflect
1847
+ def reflect # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
1909
1848
  # puts @element_cache.size.to_s
1910
1849
  @element_cache.each_value do |item|
1911
1850
  next unless item.usable
@@ -1948,23 +1887,16 @@ module Meteor
1948
1887
  #
1949
1888
  # reflect (反映する)
1950
1889
  #
1951
- def flash
1890
+ def flash # rubocop:disable Metrics/AbcSize,Metrics/MethodLength,Metrics/PerceivedComplexity
1952
1891
  if element_hook
1953
1892
  if element_hook.origin.childless
1954
1893
  if element_hook.origin.cx
1955
- # @root.hookDocument << '<!-- @' << @root.element.name << ' '
1956
- # @root.hookDocument << @root.element.attributes << '-->'
1957
- # @root.hookDocument << @root.element.mixed_content << '<!-- /@'
1958
- # @root.hookDocument << @root.element.name << ' -->'
1959
1894
  document_hook <<
1960
1895
  "<!-- @#{element_hook.name} #{element_hook.attributes}-->#{element_hook.mixed_content}<!-- /@#{element_hook.name} -->" # rubocop:disable Layout/LineLength
1961
1896
 
1962
1897
  # self.document_hook << @root.newline <<
1963
1898
  # "<!-- @#{self.element_hook.name} #{self.element_hook.attributes}-->#{self.element_hook.mixed_content}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1964
1899
  else
1965
- # @root.hookDocument << "<" << @root.element.name
1966
- # @root.hookDocument << @root.element.attributes << '>' << @root.element.mixed_content
1967
- # @root.hookDocument << '</' << @root.element.name << '>'
1968
1900
  document_hook <<
1969
1901
  "<#{element_hook.name}#{element_hook.attributes}>#{element_hook.mixed_content}</#{element_hook.name}>"
1970
1902
 
@@ -1977,22 +1909,15 @@ module Meteor
1977
1909
  @_attributes = element_hook.attributes
1978
1910
 
1979
1911
  if element_hook.origin.cx
1980
- # @root.hookDocument << '<!-- @' << @root.element.name << ' '
1981
- # @root.hookDocument << @_attributes << '-->'
1982
- # @root.hookDocument << @root.document << '<!-- /@'
1983
- # @root.hookDocument << @root.element.name << ' -->'
1984
1912
  document_hook <<
1985
1913
  "<!-- @#{element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{element_hook.name} -->"
1986
1914
 
1987
- # self.document_hook << @root.newline << "<!-- @#{self.element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{self.element_hook.name} -->" # rubocop:disable Layout/LineLength
1915
+ # self.document_hook << @root.newline << "<!-- @#{element_hook.name} #{@_attributes}-->#{@root.document}<!-- /@#{element_hook.name} -->" # rubocop:disable Layout/LineLength
1988
1916
  else
1989
- # @root.hookDocument << "<" << @root.element.name
1990
- # @root.hookDocument << @_attributes << '>' << @root.document
1991
- # @root.hookDocument << '</' << @root.element.name << '>'
1992
1917
  document_hook <<
1993
1918
  "<#{element_hook.name}#{@_attributes}>#{@root.document}</#{element_hook.name}>"
1994
1919
 
1995
- # self.document_hook << @root.newline << "<#{self.element_hook.name}#{@_attributes}>#{@root.document}</#{self.element_hook.name}>" # rubocop:disable Layout/LineLength
1920
+ # document_hook << @root.newline << "<#{element_hook.name}#{@_attributes}>#{@root.document}</#{element_hook.name}>" # rubocop:disable Layout/LineLength
1996
1921
  end
1997
1922
 
1998
1923
  end
@@ -2022,7 +1947,7 @@ module Meteor
2022
1947
  # @param [Meteor::Element] elm element (要素)
2023
1948
  # @return [Meteor::Element] element (要素)
2024
1949
  #
2025
- def shadow(elm)
1950
+ def shadow(elm) # rubocop:disable Metrics/AbcSize,Metrics/MethodLength
2026
1951
  return unless elm.normal
2027
1952
 
2028
1953
  # case of normal element (内容あり要素の場合)
@@ -2108,7 +2033,7 @@ module Meteor
2108
2033
  private :escape
2109
2034
  private :escape_content
2110
2035
 
2111
- def unescape(content)
2036
+ def unescape(content) # rubocop:disable Metrics/MethodLength
2112
2037
  # replace special character (特殊文字の置換)
2113
2038
  # 「<」<-「&lt;」
2114
2039
  # 「>」<-「&gt;」
@@ -2116,7 +2041,7 @@ module Meteor
2116
2041
  # 「 」<-「&nbsp;」
2117
2042
  # 「&」<-「&amp;」
2118
2043
  content.gsub(RE_UNESCAPE) do
2119
- case ::Regexp.last_match(1)
2044
+ case ::Regexp.last_match(1) # rubocop:disable Style/HashLikeCase
2120
2045
  when 'amp'
2121
2046
  '&'
2122
2047
  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,18 +202,14 @@ 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
209
209
  when Parser::HTML, Parser::HTML4
210
210
  @document = if @cx
211
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
212
- # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
213
211
  "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
214
212
  elsif @normal
215
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>'
216
- # << elm.mixed_content << '</' << elm.name << '>'
217
213
  "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
218
214
  else
219
215
  String.new('') << '<' << @name << @attributes << '>'
@@ -221,16 +217,12 @@ module Meteor
221
217
  end
222
218
  when Parser::XHTML, Parser::XHTML4, Parser::XML
223
219
  @document = if @cx
224
- # @pattern_cc = String.new('') << '<!-- @' << elm.name << ' ' << elm.attributes << '-->'
225
- # << elm.mixed_content << '<!-- /@' << elm.name << ' -->'
226
220
  "<!-- @#{@name} #{@attributes} -->#{@mixed_content}<!-- /@#{@name} -->"
227
221
  elsif @normal
228
- # @pattern_cc = String.new('') << "<" << elm.name << elm.attributes << '>' << elm.mixed_content
229
- # << '</' << elm.name << '>'
230
222
  "<#{@name}#{@attributes}>#{@mixed_content}</#{@name}>"
231
223
  else
232
224
  String.new('') << '<' << @name << @attributes << '/>'
233
- # @document = "<#{@name}#{@attributes}/>"
225
+ # "<#{@name}#{@attributes}/>"
234
226
  end
235
227
  end
236
228
  else
@@ -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 (空要素の場合(<->内容あり要素の場合))
@@ -203,8 +203,6 @@ module Meteor
203
203
  end
204
204
  else
205
205
  # normal element search pattern (内容あり要素検索用パターン()
206
- # @pattern_cc = String.new('') << "<" << @_name << '(|\\s[^<>]*)>(((?!(' << @_name
207
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
208
206
  @pattern_cc = "<#{@_name}(|\\s[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>"
209
207
 
210
208
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -248,7 +246,7 @@ module Meteor
248
246
  # @param [true,false] quote quote flag (クオート・フラグ)
249
247
  # @return [Meteor::Element] element (要素)
250
248
  #
251
- def element_three(name, attr_name, attr_value, quote = true)
249
+ def element_three(name, attr_name, attr_value, quote = true) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity,Style/OptionalBooleanParameter
252
250
  if quote
253
251
  quote_element_three(name, attr_name, attr_value)
254
252
  else
@@ -258,8 +256,6 @@ module Meteor
258
256
  # case of void element (空要素の場合(<->内容あり要素の場合))
259
257
  if match?(MATCH_TAG, name)
260
258
  # void element search pattern (空要素検索パターン)
261
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
262
- # @pattern_cc << @_attr_value << '"[^<>]*)>'
263
259
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>"
264
260
 
265
261
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -274,9 +270,6 @@ module Meteor
274
270
  end
275
271
  else
276
272
  # normal element search pattern (内容あり要素検索パターン)
277
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*' << @_attr_name << '="'
278
- # @pattern_cc << @_attr_value << '"[^<>]*)>(((?!(' << @_name
279
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
280
273
  @pattern_cc = "<#{@_name}(\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
281
274
 
282
275
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -311,11 +304,9 @@ module Meteor
311
304
  # @param [String] attr_value attribute value (属性値)
312
305
  # @return [Meteor::Element] element (要素)
313
306
  #
314
- def element_two(attr_name, attr_value)
307
+ def element_two(attr_name, attr_value) # rubocop:disable Metrics/MethodLength
315
308
  quote_attribute(attr_name, attr_value)
316
309
 
317
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s[^<>]*' << @_attr_name << '="' << @_attr_value
318
- # @pattern_cc << '"[^<>]*>'
319
310
  @pattern_cc = "<([^<>\"]*)\\s[^<>]*#{@_attr_name}=\"#{@_attr_value}\"[^<>]*>"
320
311
 
321
312
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -343,17 +334,12 @@ module Meteor
343
334
  # @param [String] attr_value2 attribute value2 (属性値2)
344
335
  # @return [Meteor::Element] element (要素)
345
336
  #
346
- def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
337
+ def element_five(name, attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
347
338
  quote_element_five(name, attr_name1, attr_value1, attr_name2, attr_value2)
348
339
 
349
340
  # case of void element (空要素の場合(<->内容あり要素の場合))
350
341
  if match?(MATCH_TAG, name)
351
342
  # void element search pattern (空要素検索パターン)
352
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
353
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
354
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
355
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
356
- # @pattern_cc << @_attr_value1 << '")[^<>]*)>'
357
343
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
358
344
 
359
345
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -375,12 +361,6 @@ module Meteor
375
361
  end
376
362
  else
377
363
  # normal element search pattern (内容あり要素検索パターン)
378
- # @pattern_cc = String.new('') << "<" << @_name << '(\\s[^<>]*(?:' << @_attr_name1 << '="'
379
- # @pattern_cc << @_attr_value1 << '"[^<>]*' << @_attr_name2 << '="'
380
- # @pattern_cc << @_attr_value2 << '"|' << @_attr_name2 << '="'
381
- # @pattern_cc << @_attr_value2 << '"[^<>]*' << @_attr_name1 << '="'
382
- # @pattern_cc << @_attr_value1 << '")[^<>]*)>(((?!(' << @_name
383
- # @pattern_cc << '[^<>]*>)).)*)<\\/' << @_name << '>'
384
364
  @pattern_cc = "<#{@_name}(\\s[^<>]*(?:#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>(((?!(#{@_name}[^<>]*>)).)*)<\\/#{@_name}>" # rubocop:disable Layout/LineLength
385
365
 
386
366
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -424,14 +404,9 @@ module Meteor
424
404
  # @param [String] attr_value2 attribute value2 (属性値2)
425
405
  # @return [Meteor::Element] element (要素)
426
406
  #
427
- def element_four(attr_name1, attr_value1, attr_name2, attr_value2)
407
+ def element_four(attr_name1, attr_value1, attr_name2, attr_value2) # rubocop:disable Metrics/MethodLength
428
408
  quote_element_four(attr_name1, attr_value1, attr_name2, attr_value2)
429
409
 
430
- # @pattern_cc = String.new('') << '<([^<>"]*)\\s([^<>]*(' << @_attr_name1 << '="' << @_attr_value1
431
- # @pattern_cc << '"[^<>]*' << @_attr_name2 << '="' << @_attr_value2
432
- # @pattern_cc << '"|' << @_attr_name2 << '="' << @_attr_value2
433
- # @pattern_cc << '"[^<>]*' << @_attr_name1 << '="' << @_attr_value1
434
- # @pattern_cc << '")[^<>]*)>'
435
410
  @pattern_cc = "<([^<>\"]*)\\s([^<>]*(#{@_attr_name1}=\"#{@_attr_value1}\"[^<>]*#{@_attr_name2}=\"#{@_attr_value2}\"|#{@_attr_name2}=\"#{@_attr_value2}\"[^<>]*#{@_attr_name1}=\"#{@_attr_value1}\")[^<>]*)>" # rubocop:disable Layout/LineLength
436
411
 
437
412
  @pattern = Meteor::Core::Util::PatternCache.get(@pattern_cc)
@@ -455,7 +430,7 @@ module Meteor
455
430
 
456
431
  private :element_four
457
432
 
458
- def edit_attrs_(elm, attr_name, attr_value)
433
+ def edit_attrs_(elm, attr_name, attr_value) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
459
434
  if match?('selected', attr_name) && match?('option', elm.name)
460
435
  edit_attrs_five(elm, attr_name, attr_value, RE_SELECTED_M, RE_SELECTED_R)
461
436
  elsif match?('multiple', attr_name) && match?('select', elm.name)
@@ -475,7 +450,7 @@ module Meteor
475
450
 
476
451
  private :edit_attrs_
477
452
 
478
- def edit_attrs_five(elm, attr_name, attr_value, match_p, replace)
453
+ def edit_attrs_five(elm, attr_name, attr_value, match_p, replace) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
479
454
  if true.equal?(attr_value) || match?('true', attr_value)
480
455
  @res = match_p.match(elm.attributes)
481
456
 
@@ -502,7 +477,7 @@ module Meteor
502
477
 
503
478
  private :edit_document_one
504
479
 
505
- def get_attr_value_(elm, attr_name)
480
+ def get_attr_value_(elm, attr_name) # rubocop:disable Metrics/AbcSize,Metrics/CyclomaticComplexity,Metrics/MethodLength,Metrics/PerceivedComplexity
506
481
  if match?('selected', attr_name) && match?('option', elm.name)
507
482
  get_attr_value_r(elm, RE_SELECTED_M)
508
483
  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
@@ -363,7 +363,7 @@ module Meteor
363
363
 
364
364
  private :new_parser
365
365
 
366
- def new_parser_type(type)
366
+ def new_parser_type(type) # rubocop:disable Metrics/MethodLength
367
367
  case type
368
368
  when Parser::HTML, :html
369
369
  Meteor::Ml::Html::ParserImpl.new
@@ -382,7 +382,7 @@ module Meteor
382
382
 
383
383
  private :new_parser_type
384
384
 
385
- def new_parser_ps(pif)
385
+ def new_parser_ps(pif) # rubocop:disable Metrics/MethodLength
386
386
  case pif.doc_type
387
387
  when Meteor::Parser::HTML
388
388
  Meteor::Ml::Html::ParserImpl.new(pif)
@@ -404,7 +404,7 @@ module Meteor
404
404
  # @param [String,Symbol] key identifier (キー)
405
405
  # @param [Meteor::Parser] ps parser (パーサ)
406
406
  #
407
- def []=(key, ps)
407
+ def []=(key, ps) # rubocop:disable Naming/MethodParameterName
408
408
  @cache[key] = ps
409
409
  end
410
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.39
40
+ # @version 0.9.41
41
41
  #
42
42
 
43
43
  module Meteor
44
- VERSION = '0.9.39'
44
+ VERSION = '0.9.41'
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.15'
25
+ spec.add_development_dependency 'bundler', '~> 4.0.16'
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.39
4
+ version: 0.9.41
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.15
18
+ version: 4.0.16
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.15
25
+ version: 4.0.16
26
26
  description: A lightweight (X)HTML & XML parser
27
27
  email: ys.ashida@gmail.com
28
28
  executables: []
@@ -82,7 +82,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  requirements: []
85
- rubygems_version: 4.0.15
85
+ rubygems_version: 4.0.16
86
86
  specification_version: 4
87
87
  summary: A lightweight (X)HTML & XML parser
88
88
  test_files: