fe_core_ext 0.28.0 → 0.29.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: a4c2bd081b4c23f5b77cadf7f367b306718ec447ce255b36c1784c2e7ad57664
4
- data.tar.gz: 8f5c065793e9ab678ae277927ce3c7b43960c1e3d98154767b4c4278e370bcae
3
+ metadata.gz: 3b9b658d86946ccac8f368b46e7bd11499a06a47c74b4c8edca54ef9b8ce4229
4
+ data.tar.gz: 2b2bf7e6016b90e168a17ca20e05a875f34c2ca9ea2553fbd23f63b6dad01b21
5
5
  SHA512:
6
- metadata.gz: 9547f388be92d324e5d7056e2d6ea80ba84899de21237602da1a6c7508dd74bab638e83dccfe653fc629669a9d4e27e0d4fdd3ad98abc1fd3a6e4392f825bca5
7
- data.tar.gz: 72e843ceec85b37a0d85f4f6ed58faf9d534914e56fa5e1fbafd343399ee72e192683a8c4e52495e545d7e9b656a9d650588d79807efed02425d0c1d9acdf4a2
6
+ metadata.gz: 360a5dba67f0b6c9d6a7efc9d1cc7ff6ac924b28b3d4bac62c7442181cecf10f9bb274815950f67d966257b9237eff4cd0c2152f8a9feeb5d9c95d65d69bd024
7
+ data.tar.gz: e8f828991168666de4055110e65f082983400b9daec27bce0e307d055dd93357e1e99ac1675941b568841cf7945c4ac76fa04616584d79e31805ae8fcce480f3
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,16 +1,12 @@
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
8
8
 
9
9
  module FeCoreExt::CoreExt::Hash
10
- def snake_symbolize_keys
11
- transform_keys { |key| key.to_s.snakecase.to_sym }
12
- end
13
-
14
10
  def rename_key(original_key, new_key)
15
11
  self[new_key] = delete(original_key) if key?(original_key)
16
12
  self
@@ -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,26 @@ 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
34
  end
35
35
 
36
36
  def to_pathname
@@ -38,24 +38,24 @@ module FeCoreExt::CoreExt::String
38
38
  end
39
39
 
40
40
  def not_number?
41
- to_i == 0 && match('0').nil?
41
+ to_i == 0 && match("0").nil?
42
42
  end
43
43
 
44
44
  def valid_number?
45
- match?(/^-?([0-9][\d\,\.]*)$/)
45
+ match?(/^-?([0-9][\d,.]*)$/)
46
46
  end
47
47
 
48
48
  ## deprecated
49
49
  def zen_to_han
50
- tr('0-9A-Za-z &・-()', '0-9A-Za-z &・\-()')
50
+ tr("0-9A-Za-z &・-()", '0-9A-Za-z &・\-()')
51
51
  end
52
52
 
53
53
  def alphanumeric_zen_to_han
54
- tr('0-9A-Za-z &・.-()', '0-9A-Za-z &・.\-()')
54
+ tr("0-9A-Za-z &・.-()", '0-9A-Za-z &・.\-()')
55
55
  end
56
56
 
57
57
  def to_katakana
58
- tr('ぁ-ん', 'ァ-ン')
58
+ tr("ぁ-ん", "ァ-ン")
59
59
  end
60
60
 
61
61
  def match?(str)
@@ -63,17 +63,17 @@ module FeCoreExt::CoreExt::String
63
63
  end
64
64
 
65
65
  def kana_upcase
66
- tr('ァィゥェォヵヶッャュョヮ', 'アイウエオカケツヤユヨワ')
66
+ tr("ァィゥェォヵヶッャュョヮ", "アイウエオカケツヤユヨワ")
67
67
  end
68
68
 
69
69
  def to_han_kana
70
70
  return if self.nil?
71
- NKF.nkf('-wxZ4', self)
71
+ NKF.nkf("-wxZ4", self)
72
72
  end
73
73
 
74
74
  def to_zen_kana
75
75
  return if self.nil?
76
- NKF.nkf('-wX', self)
76
+ NKF.nkf("-wX", self)
77
77
  end
78
78
 
79
79
  def to_date_in_ja
@@ -81,16 +81,16 @@ module FeCoreExt::CoreExt::String
81
81
  end
82
82
 
83
83
  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)}
84
+ match(/(\d{4})年(\d{1,2})月(\d{1,2})日/) { Date.new($1.to_i, $2.to_i, $3.to_i) }
85
85
  end
86
86
 
87
87
  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)}
88
+ match(/平成(\d{2})年(\d{1,2})月(\d{1,2})日/) { Date.new($1.to_i + 1988, $2.to_i, $3.to_i) }
89
89
  end
90
90
 
91
91
  # remove also no break space and other space like characters.
92
92
  def strong_strip
93
- reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '').reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, '')
93
+ reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, "").reverse.gsub(/^\p{Zs}+|^\p{Cf}+/, "")
94
94
  end
95
95
 
96
96
  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.28.0'
4
+ VERSION = "0.29.1"
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.28.0
4
+ version: 0.29.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tetsu
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-01-05 00:00:00.000000000 Z
11
+ date: 2023-09-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport