meteor 0.9.25 → 0.9.27

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: 972f9396e2d45e6310cbfa0fda64ae798d10e150b7241db77cc07c954aa0a8ce
4
- data.tar.gz: 07e9dc8c2e6f4018c3c00c6ed0d68fc2c2393c1daf43977e87fc50d9d063f40e
3
+ metadata.gz: 767fbc8cbdae6e5e7b833b4618639e278d8ed48d9983a629a4d766e8a2b83bc9
4
+ data.tar.gz: a99c9054bf591fbd5853ac3a4e0fc5d172841fc239941b9dba0425a39b9c922c
5
5
  SHA512:
6
- metadata.gz: e90da0e028c4cd8c41a81012fa74121c6f68d7ace825b540eea77ae9b7b8e857b99341c5eeba3c1ac0991bff7b743dad90fb406d9d95baa147c94f92cd33b214
7
- data.tar.gz: d55c86399dcdaaf6bc11fec20bf25d4ef033e5e731014cb57e80f40b647b25d0ce6dcca84e8f1ac7c222c12142cc09362bd0782cc917c219e04a97ac0cb0df3a
6
+ metadata.gz: fb1c32cfdc1445b8e2be9270f5e0621806dd5941da921969506adda5eaeb1093e9c4b8f861ab387928ba284e1ae790c2b812089b3fa56fb3ff2f53658104a689
7
+ data.tar.gz: 1c137770bb6bcb351154798916c251097b2a862e78e7b5d236bbc47fa2aec9fb7f9eaacf2a34a25b7bd8c2fe8fef3d2e9e638bb00aa5f9b3f45a17a595596127
data/ChangeLog CHANGED
@@ -1,3 +1,11 @@
1
+ == 0.9.27 / 2026-06-30 Yasumasa Ashida <ys.ashida@gmail.com>
2
+
3
+ * Refactoring
4
+
5
+ == 0.9.26 / 2026-06-30 Yasumasa Ashida <ys.ashida@gmail.com>
6
+
7
+ * Refactoring
8
+
1
9
  == 0.9.25 / 2026-06-25 Yasumasa Ashida <ys.ashida@gmail.com>
2
10
 
3
11
  * Refactoring
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- meteor (0.9.25)
4
+ meteor (0.9.27)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -111,18 +111,22 @@ module Meteor
111
111
  # set character encoding (文字エンコーディングをセットする)
112
112
  # @param [String] enc character encoding (文字エンコーディング)
113
113
  #
114
- def character_encoding=(enc)
115
- @root.character_encoding = enc
114
+ def enc=(enc)
115
+ @root.enc = enc
116
116
  end
117
117
 
118
+ alias_method :character_encoding=, :enc=
119
+
118
120
  #
119
121
  # get character encoding (文字エンコーディングを取得する)
120
122
  # @return [String] character encoding (文字エンコーディング)
121
123
  #
122
- def character_encoding
123
- @root.character_encoding
124
+ def enc
125
+ @root.enc
124
126
  end
125
127
 
128
+ alias_method :character_encoding, :enc
129
+
126
130
  #
127
131
  # get root element (ルート要素を取得する)
128
132
  # @return [Meteor::RootElement] root element (ルート要素)
@@ -158,23 +162,25 @@ module Meteor
158
162
  #
159
163
  def read(file_path, enc)
160
164
  # try {
161
- @character_encoding = enc
162
- # open file (ファイルのオープン)
163
- if "UTF-8".eql?(enc)
164
- # io = File.open(file_path,"r:" << enc)
165
- io = File.open(file_path, "r:UTF-8")
165
+ self.enc = enc
166
+ mode = if enc == "UTF-8"
167
+ # String.new("") << "r:" << enc
168
+ "r:UTF-8"
166
169
  else
167
- io = File.open(file_path, String.new("") << "r:" << enc << ":utf-8")
170
+ String.new("") << "r:" << enc << ":utf-8"
168
171
  end
169
172
 
173
+ # open file (ファイルのオープン)
174
+ io = File.open(file_path, mode)
175
+
170
176
  # load and save (読込及び格納)
171
177
  @root.document = io.read
172
178
 
173
- parse
174
-
175
179
  # close file (ファイルのクローズ)
176
180
  io.close
177
181
 
182
+ parse
183
+
178
184
  return @root.document
179
185
  end
180
186
 
@@ -2148,7 +2154,6 @@ module Meteor
2148
2154
  # private :shadow
2149
2155
 
2150
2156
  def set_mono_info(elm)
2151
-
2152
2157
  @res = @@pattern_set_mono1.match(elm.mixed_content)
2153
2158
 
2154
2159
  if @res
@@ -2164,7 +2169,7 @@ module Meteor
2164
2169
  elsif regex.kind_of?(Array)
2165
2170
  is_match_a(regex, str)
2166
2171
  elsif regex.kind_of?(String)
2167
- if regex.eql?(str.downcase)
2172
+ if regex == str.downcase
2168
2173
  true
2169
2174
  else
2170
2175
  false
@@ -2189,9 +2194,7 @@ module Meteor
2189
2194
  def is_match_a(regex, str)
2190
2195
  str = str.downcase
2191
2196
  regex.each do |item|
2192
- if item.eql?(str)
2193
- return true
2194
- end
2197
+ return true if item == str
2195
2198
  end
2196
2199
 
2197
2200
  false
@@ -112,11 +112,20 @@ module Meteor
112
112
  # @param [Meteor::Element] elm element (要素)
113
113
  #
114
114
  def initialize_e(elm)
115
+ initialize_2(elm, elm.parser)
116
+ @usable = true
117
+ end
118
+
119
+ private :initialize_e
120
+
121
+ def initialize_2(elm, ps)
122
+ @parser = ps
115
123
  if self.normal
116
- self.parser.element(elm)
124
+ ps.element(elm)
117
125
  else
118
126
  @name = elm.name
119
127
  @attributes = String.new(elm.attributes)
128
+ @mixed_content = String.new(elm.mixed_content)
120
129
  # @pattern = String.new(elm.pattern)
121
130
  @pattern = elm.pattern
122
131
  @document = String.new(elm.document)
@@ -124,29 +133,11 @@ module Meteor
124
133
  @cx = elm.cx
125
134
  @mono = elm.mono
126
135
  @origin = elm
127
- @parser = elm.parser
128
- @usable = true
136
+ # @usable = false
137
+ elm.copy = self
129
138
  end
130
139
  end
131
140
 
132
- private :initialize_e
133
-
134
- def initialize_2(elm, ps)
135
- @name = elm.name
136
- @attributes = String.new(elm.attributes)
137
- @mixed_content = String.new(elm.mixed_content)
138
- # @pattern = String.new(elm.pattern)
139
- @pattern = elm.pattern
140
- @document = String.new(elm.document)
141
- @normal = elm.normal
142
- @cx = elm.cx
143
- @mono = elm.mono
144
- @parser = ps
145
- # @usable = false
146
- @origin = elm
147
- elm.copy = self
148
- end
149
-
150
141
  private :initialize_2
151
142
 
152
143
  #
@@ -40,25 +40,26 @@ module Meteor
40
40
  end
41
41
 
42
42
  #
43
- # @overload add_str(type, relative_url, doc)
43
+ # @overload add_template(type, relative_url, doc)
44
44
  # add parser (パーサを追加する)
45
45
  # @param [Integer] 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 add_str(relative_url, doc)
49
+ # @overload add_template(relative_url, doc)
50
50
  # add 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.add_str(*args)
56
- @@pf.add_str(args)
55
+ def self.add_template(*args)
56
+ @@pf.add_template(args)
57
57
  end
58
58
 
59
59
  class << self
60
60
  alias_method :link, :add
61
- alias_method :link_str, :add_str
61
+ alias_method :add_str, :add_template
62
+ alias_method :link_str, :add_template
62
63
  end
63
64
 
64
65
  #
@@ -493,7 +493,7 @@ module Meteor
493
493
  @res = match_p.match(elm.attributes)
494
494
 
495
495
  if !@res
496
- if !"".eql?(elm.attributes) && !"".eql?(elm.attributes.strip)
496
+ if elm.attributes != "" && elm.attributes.strip != ""
497
497
  elm.attributes = String.new("") << " " << elm.attributes.strip
498
498
  else
499
499
  elm.attributes = String.new("")
@@ -161,17 +161,17 @@ module Meteor
161
161
  def add(*args)
162
162
  case args.length
163
163
  when 1
164
- add_1(args[0])
164
+ add_file_1(args[0])
165
165
  when 2
166
166
  if args[0].kind_of?(Integer) || args[0].kind_of?(Symbol)
167
- add_2_n(args[0], args[1])
167
+ add_file_2_n(args[0], args[1])
168
168
  elsif args[0].kind_of?(String)
169
- add_2_s(args[0], args[1])
169
+ add_file_2_s(args[0], args[1])
170
170
  else
171
171
  raise ArgumentError
172
172
  end
173
173
  when 3
174
- add_3(args[0], args[1], args[2])
174
+ add_file_3(args[0], args[1], args[2])
175
175
  else
176
176
  raise ArgumentError
177
177
  end
@@ -190,7 +190,7 @@ module Meteor
190
190
  if paths.length == 1
191
191
  return File.basename(paths[0], ".*")
192
192
  else
193
- if ".".eql?(paths[0])
193
+ if paths[0] == "."
194
194
  paths.delete_at(0)
195
195
  paths[paths.length - 1] = File.basename(paths[paths.length - 1], ".*")
196
196
  return String.new("") << "/" << paths.join("/")
@@ -210,7 +210,7 @@ module Meteor
210
210
  # @param [String] enc character encoding (文字エンコーディング)
211
211
  # @return [Meteor::Parser] parser(パーサ)
212
212
  #
213
- def add_3(type, relative_path, enc = "UTF-8")
213
+ def add_file_3(type, relative_path, enc = "UTF-8")
214
214
  ps = new_parser(type)
215
215
  ps.read(File.expand_path(relative_path, @root), enc)
216
216
 
@@ -218,7 +218,7 @@ module Meteor
218
218
  @cache[relative_url] = ps
219
219
  end
220
220
 
221
- private :add_3
221
+ private :add_file_3
222
222
 
223
223
  #
224
224
  # add parser (パーサを追加する)
@@ -226,11 +226,11 @@ module Meteor
226
226
  # @param [String] relative_path relative file path (相対ファイルパス)
227
227
  # @return [Meteor::Parser] parser (パーサ)
228
228
  #
229
- def add_2_n(type, relative_path)
230
- add_3(type, relative_path, @enc)
229
+ def add_file_2_n(type, relative_path)
230
+ add_file_3(type, relative_path, @enc)
231
231
  end
232
232
 
233
- private :add_2_n
233
+ private :add_file_2_n
234
234
 
235
235
  #
236
236
  # add parser (パーサを追加する)
@@ -238,22 +238,79 @@ module Meteor
238
238
  # @param [String] enc character encoding (文字エンコーディング)
239
239
  # @return [Meteor::Parser] parser (パーサ)
240
240
  #
241
- def add_2_s(relative_path, enc)
242
- add_3(@type, relative_path, enc)
241
+ def add_file_2_s(relative_path, enc)
242
+ add_file_3(@type, relative_path, enc)
243
243
  end
244
244
 
245
- private :add_2_s
245
+ private :add_file_2_s
246
246
 
247
247
  #
248
248
  # add parser (パーサを追加する)
249
249
  # @param [String] relative_path relative file path (相対ファイルパス)
250
250
  # @return [Meteor::Parser] parser (パーサ)
251
251
  #
252
- def add_1(relative_path)
253
- add_3(@type, relative_path, @enc)
252
+ def add_file_1(relative_path)
253
+ add_file_3(@type, relative_path, @enc)
254
254
  end
255
255
 
256
- private :add_1
256
+ private :add_file_1
257
+
258
+ #
259
+ # @overload add_template(type, relative_url, doc)
260
+ # add parser (パーサを追加する)
261
+ # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
262
+ # @param [String] relative_url relative URL (相対URL)
263
+ # @param [String] doc document (ドキュメント)
264
+ # @return [Meteor::Parser] parser (パーサ)
265
+ # @overload add_template(relative_url, doc)
266
+ # add parser (パーサを追加する)
267
+ # @param [String] relative_url relative URL (相対URL)
268
+ # @param [String] doc document (ドキュメント)
269
+ # @return [Meteor::Parser] parser (パーサ)
270
+ #
271
+ def add_template(*args)
272
+ case args.length
273
+ when 2
274
+ add_template_2(args[0], args[1])
275
+ when 3
276
+ add_template_3(args[0], args[1], args[2])
277
+ else
278
+ raise ArgumentError
279
+ end
280
+ end
281
+
282
+ #
283
+ # add parser (パーサを追加する)
284
+ # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
285
+ # @param [String] relative_url relative URL (相対URL)
286
+ # @param [String] doc document (ドキュメント)
287
+ # @return [Meteor::Parser] parser (パーサ)
288
+ #
289
+ def add_template_3(type, relative_url, doc)
290
+ ps = new_parser(type)
291
+ ps.document = doc
292
+ ps.parse
293
+
294
+ @cache[relative_url] = ps
295
+ end
296
+
297
+ private :add_template_3
298
+
299
+ #
300
+ # add parser (パーサを追加する)
301
+ # @param [String] relative_url relative URL (相対URL)
302
+ # @param [String] doc document (ドキュメント)
303
+ # @return [Meteor::Parser] parser (パーサ)
304
+ #
305
+ def add_template_2(relative_url, doc)
306
+ add_template_3(@type, relative_url, doc)
307
+ end
308
+
309
+ private :add_template_2
310
+
311
+ alias_method :link_str, :add_template
312
+ alias_method :add_str, :add_template
313
+ alias_method :parser_str, :add_template
257
314
 
258
315
  #
259
316
  #@overload parser(key)
@@ -315,62 +372,6 @@ module Meteor
315
372
  parser_1(key).root_element
316
373
  end
317
374
 
318
- #
319
- # @overload add_str(type, relative_url, doc)
320
- # add parser (パーサを追加する)
321
- # @param [Integer] type type of parser (パーサ・タイプ)
322
- # @param [String] relative_url relative URL (相対URL)
323
- # @param [String] doc document (ドキュメント)
324
- # @return [Meteor::Parser] parser (パーサ)
325
- # @overload add_str(relative_url, doc)
326
- # add parser (パーサを追加する)
327
- # @param [String] relative_url relative URL (相対URL)
328
- # @param [String] doc document (ドキュメント)
329
- # @return [Meteor::Parser] parser (パーサ)
330
- #
331
- def add_str(*args)
332
- case args.length
333
- when 2
334
- add_str_2(args[0], args[1])
335
- when 3
336
- add_str_3(args[0], args[1], args[2])
337
- else
338
- raise ArgumentError
339
- end
340
- end
341
-
342
- #
343
- # add parser (パーサを追加する)
344
- # @param [Integer,Symbol] type type of parser (パーサ・タイプ)
345
- # @param [String] relative_url relative URL (相対URL)
346
- # @param [String] doc document (ドキュメント)
347
- # @return [Meteor::Parser] parser (パーサ)
348
- #
349
- def add_str_3(type, relative_url, doc)
350
- ps = new_parser(type)
351
- ps.document = doc
352
- ps.parse
353
-
354
- @cache[relative_url] = ps
355
- end
356
-
357
- private :add_str_3
358
-
359
- #
360
- # add parser (パーサを追加する)
361
- # @param [String] relative_url relative URL (相対URL)
362
- # @param [String] doc document (ドキュメント)
363
- # @return [Meteor::Parser] parser (パーサ)
364
- #
365
- def add_str_2(relative_url, doc)
366
- add_str_3(@type, relative_url, doc)
367
- end
368
-
369
- private :add_str_2
370
-
371
- alias_method :link_str, :add_str
372
- alias_method :parser_str, :add_str
373
-
374
375
  def new_parser(type)
375
376
  case type
376
377
  when Parser::HTML, :html
@@ -11,14 +11,17 @@ module Meteor
11
11
  # @return [String] newline (改行コード)
12
12
  # @!attribute [rw] charset
13
13
  # @return [String] charset (文字コード)
14
- # @!attribute [rw] character_encoding
14
+ # @!attribute [rw] enc
15
15
  # @return [String] character encoding (文字エンコーディング)
16
16
  #
17
17
  class RootElement < Element
18
18
  attr_accessor :content_type
19
19
  attr_accessor :kaigyo_code
20
20
  attr_accessor :charset
21
- attr_accessor :character_encoding
21
+ attr_accessor :enc
22
22
  # attr_accessor :document #[String] document (ドキュメント)
23
+
24
+ alias_method :character_encoding, :enc
25
+ alias_method :character_encoding=, :enc=
23
26
  end
24
27
  end
data/lib/meteor.rb CHANGED
@@ -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.25
39
+ # @version 0.9.27
40
40
  #
41
41
 
42
42
  module Meteor
43
- VERSION = "0.9.25"
43
+ VERSION = "0.9.27"
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.25
4
+ version: 0.9.27
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yasumasa Ashida