fe_core_ext 0.29.0 → 0.30.0

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: 330a91dfca6ac32ddbadc3296c7b306988fd99576389945651297c7fb8e1d1eb
4
- data.tar.gz: 36777e73316edb947dbe40e926a03369c33f465841e20997f608eb572a27fcab
3
+ metadata.gz: f40fe7ccde48d9cfab57b3a2de229be1a5fd4f89f35be3b1e8cd4665056dc59d
4
+ data.tar.gz: c746891e774fa9412603cf0c74b3075b4e5708f6a94f3c9ed20cb672c28eb7d5
5
5
  SHA512:
6
- metadata.gz: 47e082d5b55d13a1c4a62692e6a89ce300210f83edd1b41d17cdefb51ff4987dc5555b833728863a97af74f7645ffbdc60707f261f68e2b64155d122106a4885
7
- data.tar.gz: 6798dee768d9bc5b9d23054bf689d448ca1e78d2da270f8853c7021bee2cfcb0d7fa9f10a62f00f263ce0d60b650824eea0ce2502da883b306945941d93ffd6f
6
+ metadata.gz: 9e38d92bd1007cb2faeb82618be88beab4bb5b46d5a10c278999c009b182f869d982a8ae2823fb9ff668dc416e5b5465cf5da012de7ebe6ce9e0eb191bd5327f
7
+ data.tar.gz: 2eb8148831b69b2008e2b916744063579fe02222ac072243a4d43a31ba52de98e5e85873c5e32ce769235a5c9844f2f4fedf746d8324372f590eb20da5c34b06
data/Gemfile CHANGED
@@ -1,11 +1,10 @@
1
- source 'https://rubygems.org'
1
+ source "https://rubygems.org"
2
2
 
3
3
  # Specify your gem's dependencies in fe_core_ext.gemspec
4
4
  gemspec
5
5
 
6
- gem 'bigdecimal'
7
- gem 'timecop'
8
- gem 'test-unit'
9
- gem 'pry'
10
- gem 'awesome_print'
11
-
6
+ gem "bigdecimal"
7
+ gem "timecop"
8
+ gem "test-unit"
9
+ gem "pry"
10
+ gem "awesome_print"
data/Rakefile CHANGED
@@ -1,4 +1,4 @@
1
- require 'bundler/gem_tasks'
1
+ require "bundler/gem_tasks"
2
2
  # require 'rspec/core/rake_task'
3
3
  #
4
4
  # RSpec::Core::RakeTask.new(:spec)
data/fe_core_ext.gemspec CHANGED
@@ -1,27 +1,27 @@
1
1
  # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
2
+ lib = File.expand_path("../lib", __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'fe_core_ext/version'
4
+ require "fe_core_ext/version"
5
5
 
6
6
  Gem::Specification.new do |spec|
7
- spec.name = 'fe_core_ext'
8
- spec.version = FeCoreExt::VERSION
9
- spec.authors = ['Tetsu']
10
- spec.email = ['eisensand@gmail.com']
7
+ spec.name = "fe_core_ext"
8
+ spec.version = FeCoreExt::VERSION
9
+ spec.authors = ["Tetsu"]
10
+ spec.email = ["eisensand@gmail.com"]
11
11
 
12
- spec.summary = %q{Core class extensions}
13
- spec.description = %q{Core class extensions that doesn't supported by active_recored core_ext}
14
- spec.homepage = 'http://github.com/ironsand/fe_core_ext'
15
- spec.license = 'MIT'
12
+ spec.summary = %q{Core class extensions}
13
+ spec.description = %q{Core class extensions that doesn't supported by active_recored core_ext}
14
+ spec.homepage = "http://github.com/ironsand/fe_core_ext"
15
+ spec.license = "MIT"
16
16
 
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = 'exe'
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ['lib']
17
+ spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
+ spec.bindir = "exe"
19
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
+ spec.require_paths = ["lib"]
21
21
 
22
- spec.add_runtime_dependency 'activesupport'
23
- spec.add_development_dependency 'bundler', '~> 2.1'
24
- spec.add_development_dependency 'rake', '~> 12.3'
25
- spec.add_development_dependency 'rspec', '~> 0'
26
- spec.add_development_dependency 'selenium-webdriver', '~> 0'
22
+ spec.add_runtime_dependency "activesupport"
23
+ spec.add_development_dependency "bundler", "~> 2.1"
24
+ spec.add_development_dependency "rake", "~> 12.3"
25
+ spec.add_development_dependency "rspec", "~> 0"
26
+ spec.add_development_dependency "selenium-webdriver", "~> 0"
27
27
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bigdecimal'
4
- require 'bigdecimal/util'
3
+ require "bigdecimal"
4
+ require "bigdecimal/util"
5
5
 
6
6
  module FeCoreExt::CoreExt
7
7
  end
@@ -41,10 +41,9 @@ module FeCoreExt::CoreExt::Array
41
41
  # ブロックを持たない場合
42
42
  return temp.delete_if unless block_given?
43
43
 
44
- self.each{|val| temp.delete(val) if yield(val)}
44
+ self.each { |val| temp.delete(val) if yield(val) }
45
45
  temp
46
46
  end
47
-
48
47
  end
49
48
 
50
49
  class Array
@@ -1,14 +1,13 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bigdecimal'
4
- require 'bigdecimal/util'
5
- require 'csv'
3
+ require "bigdecimal"
4
+ require "bigdecimal/util"
5
+ require "csv"
6
6
 
7
7
  module FeCoreExt::CoreExt
8
8
  end
9
9
 
10
10
  module FeCoreExt::CoreExt::CSV
11
-
12
11
  end
13
12
 
14
13
  class CSV
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/time'
3
+ require "active_support"
4
+ require "active_support/time"
5
5
 
6
6
  module FeCoreExt::CoreExt
7
7
  end
@@ -48,7 +48,7 @@ module FeCoreExt::CoreExt::DateClassMethods
48
48
 
49
49
  def parse_reiwa(string)
50
50
  string.match('令和(\S+)年(\d+)月(\d+)日') do
51
- year = 1 if ::Regexp.last_match(1) == ''
51
+ year = 1 if ::Regexp.last_match(1) == ""
52
52
  year ||= ::Regexp.last_match(1).to_i
53
53
  Date.new(year + 2018, ::Regexp.last_match(2).to_i, ::Regexp.last_match(3).to_i)
54
54
  end
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/core_ext/hash'
3
+ require "active_support"
4
+ require "active_support/core_ext/hash"
5
5
 
6
6
  module FeCoreExt::CoreExt
7
7
  end
@@ -11,4 +11,4 @@ end
11
11
 
12
12
  class Numeric
13
13
  include FeCoreExt::CoreExt::Numeric
14
- end
14
+ end
@@ -1,8 +1,8 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'pathname'
4
- require 'yaml'
5
- require 'fileutils'
3
+ require "pathname"
4
+ require "yaml"
5
+ require "fileutils"
6
6
 
7
7
  module FeCoreExt::CoreExt
8
8
  end
@@ -21,11 +21,11 @@ module FeCoreExt::CoreExt::Pathname
21
21
  self if exist?
22
22
  end
23
23
 
24
- def touch(options={})
24
+ def touch(options = {})
25
25
  FileUtils.touch(@path, options)
26
26
  end
27
27
 
28
- def rm(options={})
28
+ def rm(options = {})
29
29
  FileUtils.rm(self, options)
30
30
  end
31
31
 
@@ -48,7 +48,7 @@ module FeCoreExt::CoreExt::PathnameClassMethods
48
48
  new(File.join(*args))
49
49
  end
50
50
 
51
- def mktmpdir(prefix_suffix=nil, tmpdir=nil)
51
+ def mktmpdir(prefix_suffix = nil, tmpdir = nil)
52
52
  if block_given?
53
53
  Dir.mktmpdir prefix_suffix, tmpdir do |dir|
54
54
  yield new(dir)
@@ -1,9 +1,9 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'bigdecimal'
4
- require 'bigdecimal/util'
5
- require 'pathname'
6
- require 'nkf'
3
+ require "bigdecimal"
4
+ require "bigdecimal/util"
5
+ require "pathname"
6
+ require "nkf"
7
7
 
8
8
  module FeCoreExt::CoreExt
9
9
  end
@@ -11,26 +11,31 @@ end
11
11
  module FeCoreExt::CoreExt::String
12
12
  def to_integer
13
13
  return unless valid_number?
14
- delete(',').to_i
14
+ delete(",").to_i
15
15
  end
16
16
 
17
17
  def integer?
18
- self.to_integer.to_s == self.delete(',')
18
+ self.to_integer.to_s == self.delete(",")
19
19
  end
20
20
 
21
21
  def to_decimal
22
22
  return unless valid_number?
23
- delete(',').to_d
23
+ delete(",").to_d
24
24
  end
25
25
 
26
26
  def to_decimal_new
27
27
  return unless valid_number?
28
- delete(',').to_d
28
+ delete(",").to_d
29
29
  end
30
30
 
31
31
  def to_float
32
32
  return unless valid_number?
33
- delete(',').to_f
33
+ delete(",").to_f
34
+ end
35
+
36
+ def valid_sec_code?
37
+ valid_chars = "[0-9ACDFGHJKLMNPRSTUWXY]"
38
+ match?(/^\d#{valid_chars}\d#{valid_chars}$/)
34
39
  end
35
40
 
36
41
  def to_pathname
@@ -38,7 +43,7 @@ module FeCoreExt::CoreExt::String
38
43
  end
39
44
 
40
45
  def not_number?
41
- to_i == 0 && match('0').nil?
46
+ to_i == 0 && match("0").nil?
42
47
  end
43
48
 
44
49
  def valid_number?
@@ -47,15 +52,15 @@ module FeCoreExt::CoreExt::String
47
52
 
48
53
  ## deprecated
49
54
  def zen_to_han
50
- tr('0-9A-Za-z &・-()', '0-9A-Za-z &・\-()')
55
+ tr("0-9A-Za-z &・-()", '0-9A-Za-z &・\-()')
51
56
  end
52
57
 
53
58
  def alphanumeric_zen_to_han
54
- tr('0-9A-Za-z &・.-()', '0-9A-Za-z &・.\-()')
59
+ tr("0-9A-Za-z &・.-()", '0-9A-Za-z &・.\-()')
55
60
  end
56
61
 
57
62
  def to_katakana
58
- tr('ぁ-ん', 'ァ-ン')
63
+ tr("ぁ-ん", "ァ-ン")
59
64
  end
60
65
 
61
66
  def match?(str)
@@ -63,17 +68,17 @@ module FeCoreExt::CoreExt::String
63
68
  end
64
69
 
65
70
  def kana_upcase
66
- tr('ァィゥェォヵヶッャュョヮ', 'アイウエオカケツヤユヨワ')
71
+ tr("ァィゥェォヵヶッャュョヮ", "アイウエオカケツヤユヨワ")
67
72
  end
68
73
 
69
74
  def to_han_kana
70
75
  return if self.nil?
71
- NKF.nkf('-wxZ4', self)
76
+ NKF.nkf("-wxZ4", self)
72
77
  end
73
78
 
74
79
  def to_zen_kana
75
80
  return if self.nil?
76
- NKF.nkf('-wX', self)
81
+ NKF.nkf("-wX", self)
77
82
  end
78
83
 
79
84
  def to_date_in_ja
@@ -81,16 +86,16 @@ module FeCoreExt::CoreExt::String
81
86
  end
82
87
 
83
88
  def to_date_in_ja_seireki
84
- match(/(\d{4})年(\d{1,2})月(\d{1,2})日/) {Date.new($1.to_i, $2.to_i, $3.to_i)}
89
+ match(/(\d{4})年(\d{1,2})月(\d{1,2})日/) { Date.new($1.to_i, $2.to_i, $3.to_i) }
85
90
  end
86
91
 
87
92
  def to_date_in_ja_heisei
88
- match(/平成(\d{2})年(\d{1,2})月(\d{1,2})日/) {Date.new($1.to_i + 1988, $2.to_i, $3.to_i)}
93
+ match(/平成(\d{2})年(\d{1,2})月(\d{1,2})日/) { Date.new($1.to_i + 1988, $2.to_i, $3.to_i) }
89
94
  end
90
95
 
91
96
  # remove also no break space and other space like characters.
92
97
  def strong_strip
93
- reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '').reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '')
98
+ reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, "").reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, "")
94
99
  end
95
100
 
96
101
  def sjis_encodable
@@ -1,7 +1,7 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'active_support'
4
- require 'active_support/time'
3
+ require "active_support"
4
+ require "active_support/time"
5
5
 
6
6
  module FeCoreExt::CoreExt
7
7
  end
@@ -1,29 +1,29 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'uri'
4
- require 'fileutils'
5
- require 'open-uri'
6
- require 'net/http'
3
+ require "uri"
4
+ require "fileutils"
5
+ require "open-uri"
6
+ require "net/http"
7
7
 
8
8
  module FeCoreExt::CoreExt
9
9
  end
10
10
 
11
11
  module URI
12
12
  def download(file)
13
- warn 'URI#downloadの引数にはPathnameを使いましょう!' if file.is_a?(String)
13
+ warn "URI#downloadの引数にはPathnameを使いましょう!" if file.is_a?(String)
14
14
  binary = OpenURI.open_uri(self).read
15
- file = file + self.basename if file.to_s[-1] == '/'
15
+ file = file + self.basename if file.to_s[-1] == "/"
16
16
  dirname = ::File.dirname(file)
17
17
  ::FileUtils.mkdir_p(dirname) unless ::File.directory?(dirname)
18
- ::File.open(file, 'wb') {|f| f.write(binary)}
18
+ ::File.open(file, "wb") { |f| f.write(binary) }
19
19
  end
20
20
 
21
21
  def exists?
22
22
  req = ::Net::HTTP.new(host, port)
23
- req.use_ssl = true if scheme == 'https'
23
+ req.use_ssl = true if scheme == "https"
24
24
  res = req.request_head(path)
25
- return URI(res['location']).exists? if %w(301 302).include?(res.code)
26
- res.code == '200'
25
+ return URI(res["location"]).exists? if %w(301 302).include?(res.code)
26
+ res.code == "200"
27
27
  end
28
28
  end
29
29
 
@@ -50,4 +50,4 @@ end
50
50
 
51
51
  class Selenium::WebDriver::Element
52
52
  include Selenium::WebDriver::Find
53
- end
53
+ end
@@ -1 +1 @@
1
- require 'fe_core_ext/gem_ext/selenium_webdriver'
1
+ require "fe_core_ext/gem_ext/selenium_webdriver"
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module FeCoreExt
4
- VERSION = '0.29.0'
4
+ VERSION = "0.30.0"
5
5
  end
data/lib/fe_core_ext.rb CHANGED
@@ -1,14 +1,14 @@
1
- require_relative 'fe_core_ext/version'
2
- require_relative 'fe_core_ext/core_ext/array'
3
- require_relative 'fe_core_ext/core_ext/csv'
4
- require_relative 'fe_core_ext/core_ext/date'
5
- require_relative 'fe_core_ext/core_ext/hash'
6
- require_relative 'fe_core_ext/core_ext/integer'
7
- require_relative 'fe_core_ext/core_ext/numeric'
8
- require_relative 'fe_core_ext/core_ext/pathname'
9
- require_relative 'fe_core_ext/core_ext/string'
10
- require_relative 'fe_core_ext/core_ext/time'
11
- require_relative 'fe_core_ext/core_ext/uri'
1
+ require_relative "fe_core_ext/version"
2
+ require_relative "fe_core_ext/core_ext/array"
3
+ require_relative "fe_core_ext/core_ext/csv"
4
+ require_relative "fe_core_ext/core_ext/date"
5
+ require_relative "fe_core_ext/core_ext/hash"
6
+ require_relative "fe_core_ext/core_ext/integer"
7
+ require_relative "fe_core_ext/core_ext/numeric"
8
+ require_relative "fe_core_ext/core_ext/pathname"
9
+ require_relative "fe_core_ext/core_ext/string"
10
+ require_relative "fe_core_ext/core_ext/time"
11
+ require_relative "fe_core_ext/core_ext/uri"
12
12
 
13
13
  module FeCoreExt
14
14
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fe_core_ext
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.29.0
4
+ version: 0.30.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-07 00:00:00.000000000 Z
11
+ date: 2023-10-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -130,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  - !ruby/object:Gem::Version
131
131
  version: '0'
132
132
  requirements: []
133
- rubygems_version: 3.2.33
133
+ rubygems_version: 3.4.10
134
134
  signing_key:
135
135
  specification_version: 4
136
136
  summary: Core class extensions