thefox-ext 1.4.0 → 1.6.3.pre.rc.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.editorconfig +15 -0
- data/.env.example +2 -0
- data/.github/workflows/ci.yml +39 -0
- data/.github/workflows/release.yml +38 -0
- data/.gitignore +3 -4
- data/CHANGELOG-v1.md +68 -0
- data/LICENSE +21 -0
- data/README.md +20 -13
- data/bin/.gitignore +1 -0
- data/bin/install.sh +51 -0
- data/bin/release.sh +37 -0
- data/bin/setup.sh +17 -0
- data/bin/test.sh +13 -0
- data/bin/uninstall.sh +24 -0
- data/lib/thefox-ext.rb +1 -0
- data/lib/thefox-ext/console.rb +47 -47
- data/lib/thefox-ext/ext/array.rb +38 -0
- data/lib/thefox-ext/ext/date.rb +42 -41
- data/lib/thefox-ext/ext/false.rb +6 -3
- data/lib/thefox-ext/ext/hash.rb +62 -55
- data/lib/thefox-ext/ext/integer.rb +3 -3
- data/lib/thefox-ext/ext/nil.rb +3 -3
- data/lib/thefox-ext/ext/string.rb +63 -57
- data/lib/thefox-ext/ext/true.rb +6 -3
- data/lib/thefox-ext/version.rb +5 -4
- data/thefox-ext.code-workspace +32 -0
- data/thefox-ext.gemspec +9 -7
- metadata +53 -21
- data/.travis.yml +0 -16
- data/Makefile +0 -8
- data/Makefile.common +0 -53
- data/tests/tc_date.rb +0 -70
- data/tests/tc_false.rb +0 -11
- data/tests/tc_hash.rb +0 -103
- data/tests/tc_integer.rb +0 -20
- data/tests/tc_nil.rb +0 -11
- data/tests/tc_string.rb +0 -87
- data/tests/tc_true.rb +0 -11
- data/tests/ts_all.rb +0 -9
- data/thefox-ext.sublime-project +0 -10
data/thefox-ext.gemspec
CHANGED
@@ -11,15 +11,17 @@ Gem::Specification.new do |spec|
|
|
11
11
|
spec.date = TheFox::Ext::DATE
|
12
12
|
spec.author = 'Christian Mayer'
|
13
13
|
spec.email = 'christian@fox21.at'
|
14
|
-
|
14
|
+
|
15
15
|
spec.summary = %q{Extended Ruby Classes}
|
16
|
-
spec.description = %q{
|
17
|
-
spec.homepage =
|
18
|
-
spec.license = '
|
19
|
-
|
16
|
+
spec.description = %q{This gem extents some of the basic Ruby classes by missing functionalities.}
|
17
|
+
spec.homepage = TheFox::Ext::HOMEPAGE
|
18
|
+
spec.license = 'MIT'
|
19
|
+
|
20
20
|
spec.files = `git ls-files -z`.split("\x0").reject{ |f| f.match(%r{^(test|spec|features)/}) }
|
21
21
|
spec.require_paths = ['lib']
|
22
|
-
spec.required_ruby_version = '>=2.
|
23
|
-
|
22
|
+
spec.required_ruby_version = ['>=2.3.0', '<3.0']
|
23
|
+
|
24
24
|
spec.add_development_dependency 'minitest', '~>5.8'
|
25
|
+
spec.add_development_dependency 'simplecov', '~>0.13'
|
26
|
+
spec.add_development_dependency 'simplecov-phpunit', '~>1.0'
|
25
27
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: thefox-ext
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4
|
4
|
+
version: 1.6.3.pre.rc.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Christian Mayer
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: minitest
|
@@ -24,20 +24,58 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '5.8'
|
27
|
-
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: simplecov
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.13'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.13'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: simplecov-phpunit
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.0'
|
55
|
+
description: This gem extents some of the basic Ruby classes by missing functionalities.
|
28
56
|
email: christian@fox21.at
|
29
57
|
executables: []
|
30
58
|
extensions: []
|
31
59
|
extra_rdoc_files: []
|
32
60
|
files:
|
61
|
+
- ".editorconfig"
|
62
|
+
- ".env.example"
|
63
|
+
- ".github/workflows/ci.yml"
|
64
|
+
- ".github/workflows/release.yml"
|
33
65
|
- ".gitignore"
|
34
|
-
-
|
66
|
+
- CHANGELOG-v1.md
|
35
67
|
- Gemfile
|
36
|
-
-
|
37
|
-
- Makefile.common
|
68
|
+
- LICENSE
|
38
69
|
- README.md
|
70
|
+
- bin/.gitignore
|
71
|
+
- bin/install.sh
|
72
|
+
- bin/release.sh
|
73
|
+
- bin/setup.sh
|
74
|
+
- bin/test.sh
|
75
|
+
- bin/uninstall.sh
|
39
76
|
- lib/thefox-ext.rb
|
40
77
|
- lib/thefox-ext/console.rb
|
78
|
+
- lib/thefox-ext/ext/array.rb
|
41
79
|
- lib/thefox-ext/ext/date.rb
|
42
80
|
- lib/thefox-ext/ext/false.rb
|
43
81
|
- lib/thefox-ext/ext/hash.rb
|
@@ -46,19 +84,11 @@ files:
|
|
46
84
|
- lib/thefox-ext/ext/string.rb
|
47
85
|
- lib/thefox-ext/ext/true.rb
|
48
86
|
- lib/thefox-ext/version.rb
|
49
|
-
-
|
50
|
-
- tests/tc_false.rb
|
51
|
-
- tests/tc_hash.rb
|
52
|
-
- tests/tc_integer.rb
|
53
|
-
- tests/tc_nil.rb
|
54
|
-
- tests/tc_string.rb
|
55
|
-
- tests/tc_true.rb
|
56
|
-
- tests/ts_all.rb
|
87
|
+
- thefox-ext.code-workspace
|
57
88
|
- thefox-ext.gemspec
|
58
|
-
- thefox-ext.sublime-project
|
59
89
|
homepage: https://github.com/TheFox/ext.rb
|
60
90
|
licenses:
|
61
|
-
-
|
91
|
+
- MIT
|
62
92
|
metadata: {}
|
63
93
|
post_install_message:
|
64
94
|
rdoc_options: []
|
@@ -68,17 +98,19 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
68
98
|
requirements:
|
69
99
|
- - ">="
|
70
100
|
- !ruby/object:Gem::Version
|
71
|
-
version: 2.
|
101
|
+
version: 2.3.0
|
102
|
+
- - "<"
|
103
|
+
- !ruby/object:Gem::Version
|
104
|
+
version: '3.0'
|
72
105
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
106
|
requirements:
|
74
|
-
- - "
|
107
|
+
- - ">"
|
75
108
|
- !ruby/object:Gem::Version
|
76
|
-
version:
|
109
|
+
version: 1.3.1
|
77
110
|
requirements: []
|
78
111
|
rubyforge_project:
|
79
|
-
rubygems_version: 2.4
|
112
|
+
rubygems_version: 2.6.14.4
|
80
113
|
signing_key:
|
81
114
|
specification_version: 4
|
82
115
|
summary: Extended Ruby Classes
|
83
116
|
test_files: []
|
84
|
-
has_rdoc:
|
data/.travis.yml
DELETED
@@ -1,16 +0,0 @@
|
|
1
|
-
language: ruby
|
2
|
-
rvm:
|
3
|
-
- 2.1
|
4
|
-
- 2.2
|
5
|
-
sudo: required
|
6
|
-
before_install:
|
7
|
-
- gem update --system
|
8
|
-
- gem install bundler -v '~>1.11'
|
9
|
-
- bundler --version
|
10
|
-
install:
|
11
|
-
- make
|
12
|
-
- gem build thefox-ext.gemspec
|
13
|
-
- gem install thefox-ext-*.gem
|
14
|
-
- gem list -l thefox-ext
|
15
|
-
script:
|
16
|
-
- make test
|
data/Makefile
DELETED
data/Makefile.common
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
|
2
|
-
# Ruby Common Big
|
3
|
-
# 2015-12-21
|
4
|
-
|
5
|
-
MV = mv -nv
|
6
|
-
RM = rm -rf
|
7
|
-
MKDIR = mkdir -p
|
8
|
-
BUNDLER = bundle
|
9
|
-
BUNDLER_OPTIONS = --jobs=5 --retry=3
|
10
|
-
GEMSPEC_FILE = $(GEM_NAME).gemspec
|
11
|
-
|
12
|
-
.PHONY: all $(ALL_TARGETS_EXT)
|
13
|
-
all: setup
|
14
|
-
|
15
|
-
.PHONY: setup
|
16
|
-
setup: .setup
|
17
|
-
|
18
|
-
.setup:
|
19
|
-
$(BUNDLER) install $(BUNDLER_OPTIONS)
|
20
|
-
touch $@
|
21
|
-
|
22
|
-
.PHONY: install
|
23
|
-
install:
|
24
|
-
gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
|
25
|
-
sudo gem install $$gem_file; \
|
26
|
-
$(RM) $$gem_file
|
27
|
-
|
28
|
-
.PHONY: uninstall
|
29
|
-
uninstall:
|
30
|
-
sudo gem uninstall $(GEM_NAME)
|
31
|
-
|
32
|
-
.PHONY: update
|
33
|
-
update:
|
34
|
-
$(BUNDLER) update
|
35
|
-
|
36
|
-
.PHONY: clean
|
37
|
-
clean:
|
38
|
-
$(RM) .bundle
|
39
|
-
$(RM) .setup
|
40
|
-
$(RM) Gemfile.lock
|
41
|
-
|
42
|
-
.PHONY: release
|
43
|
-
release: | releases
|
44
|
-
set -e; \
|
45
|
-
gem_file=$$(gem build $(GEMSPEC_FILE) | grep 'File:' | tail -1 | awk '{ print $$2 }'); \
|
46
|
-
dst="releases/$$gem_file"; \
|
47
|
-
[ ! -f $$dst ]; \
|
48
|
-
$(MV) $$gem_file releases; \
|
49
|
-
gem push $$dst; \
|
50
|
-
echo 'done'
|
51
|
-
|
52
|
-
releases:
|
53
|
-
$(MKDIR) $@
|
data/tests/tc_date.rb
DELETED
@@ -1,70 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'thefox-ext'
|
5
|
-
|
6
|
-
|
7
|
-
class TestDate < MiniTest::Test
|
8
|
-
def test_today
|
9
|
-
assert_equal(true, Date.today.today?)
|
10
|
-
|
11
|
-
assert_equal(false, Date.new(2001, 2, 3).today?)
|
12
|
-
assert_equal(false, Date.new(2001, 2, 4).today?)
|
13
|
-
|
14
|
-
# This test may fail on 01.01.2018 ;)
|
15
|
-
assert_equal(false, Date.new(2018, 1, 1).today?)
|
16
|
-
|
17
|
-
assert_equal(true, Time.now.to_date.today?)
|
18
|
-
end
|
19
|
-
|
20
|
-
def test_week_mid
|
21
|
-
e = ['2014-02-17', '2014-02-18', '2014-02-19', '2014-02-20', '2014-02-21', '2014-02-22', '2014-02-23']
|
22
|
-
assert_equal(e, Date.new(2014, 2, 21).week.map{ |d| "#{d}" })
|
23
|
-
|
24
|
-
e = ['2014-03-31', '2014-04-01', '2014-04-02', '2014-04-03', '2014-04-04', '2014-04-05', '2014-04-06']
|
25
|
-
assert_equal(e, Date.new(2014, 4, 1).week.map{ |d| "#{d}" })
|
26
|
-
|
27
|
-
e = ['2015-02-16', '2015-02-17', '2015-02-18', '2015-02-19', '2015-02-20', '2015-02-21', '2015-02-22']
|
28
|
-
assert_equal(e, Date.new(2015, 2, 21).week.map{ |d| "#{d}" })
|
29
|
-
|
30
|
-
e = ['2016-02-15', '2016-02-16', '2016-02-17', '2016-02-18', '2016-02-19', '2016-02-20', '2016-02-21']
|
31
|
-
assert_equal(e, Date.new(2016, 2, 21).week.map{ |d| "#{d}" })
|
32
|
-
end
|
33
|
-
|
34
|
-
def test_week_jan
|
35
|
-
e = ['2013-12-30', '2013-12-31', '2014-01-01', '2014-01-02', '2014-01-03', '2014-01-04', '2014-01-05']
|
36
|
-
assert_equal(e, Date.new(2014, 1, 1).week.map{ |d| "#{d}" })
|
37
|
-
|
38
|
-
e = ['2014-12-29', '2014-12-30', '2014-12-31',
|
39
|
-
'2015-01-01', '2015-01-02', '2015-01-03', '2015-01-04']
|
40
|
-
assert_equal(e, Date.new(2015, 1, 1).week.map{ |d| "#{d}" })
|
41
|
-
|
42
|
-
e = ['2015-12-28', '2015-12-29', '2015-12-30', '2015-12-31',
|
43
|
-
'2016-01-01', '2016-01-02', '2016-01-03']
|
44
|
-
assert_equal(e, Date.new(2016, 1, 1).week.map{ |d| "#{d}" })
|
45
|
-
|
46
|
-
e = ['2016-12-26', '2016-12-27', '2016-12-28', '2016-12-29', '2016-12-30', '2016-12-31',
|
47
|
-
'2017-01-01']
|
48
|
-
assert_equal(e, Date.new(2017, 1, 1).week.map{ |d| "#{d}" })
|
49
|
-
|
50
|
-
e = ['2018-01-01', '2018-01-02', '2018-01-03', '2018-01-04', '2018-01-05', '2018-01-06', '2018-01-07']
|
51
|
-
assert_equal(e, Date.new(2018, 1, 1).week.map{ |d| "#{d}" })
|
52
|
-
end
|
53
|
-
|
54
|
-
def test_week_dec
|
55
|
-
e = ['2014-12-29', '2014-12-30', '2014-12-31',
|
56
|
-
'2015-01-01', '2015-01-02', '2015-01-03', '2015-01-04']
|
57
|
-
assert_equal(e, Date.new(2014, 12, 31).week.map{ |d| "#{d}" })
|
58
|
-
|
59
|
-
e = ['2015-12-28', '2015-12-29', '2015-12-30', '2015-12-31',
|
60
|
-
'2016-01-01', '2016-01-02', '2016-01-03']
|
61
|
-
assert_equal(e, Date.new(2015, 12, 31).week.map{ |d| "#{d}" })
|
62
|
-
|
63
|
-
e = ['2016-12-26', '2016-12-27', '2016-12-28', '2016-12-29', '2016-12-30', '2016-12-31',
|
64
|
-
'2017-01-01']
|
65
|
-
assert_equal(e, Date.new(2016, 12, 31).week.map{ |d| "#{d}" })
|
66
|
-
|
67
|
-
e = ['2017-12-25', '2017-12-26', '2017-12-27', '2017-12-28', '2017-12-29', '2017-12-30', '2017-12-31']
|
68
|
-
assert_equal(e, Date.new(2017, 12, 31).week.map{ |d| "#{d}" })
|
69
|
-
end
|
70
|
-
end
|
data/tests/tc_false.rb
DELETED
data/tests/tc_hash.rb
DELETED
@@ -1,103 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'thefox-ext'
|
5
|
-
|
6
|
-
|
7
|
-
class TestHash < MiniTest::Test
|
8
|
-
def test_merge_recursive_clone1
|
9
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
10
|
-
h2 = {'k1' => 2, 'k2' => 2}
|
11
|
-
|
12
|
-
assert_equal({'k1' => 2, 'k2' => 2}, h1.merge_recursive(h2))
|
13
|
-
end
|
14
|
-
|
15
|
-
def test_merge_recursive_clone2
|
16
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
17
|
-
h2 = {'k1' => 2, 'k3' => 2}
|
18
|
-
|
19
|
-
assert_equal({'k1' => 2, 'k2' => 1, 'k3' => 2}, h1.merge_recursive(h2))
|
20
|
-
end
|
21
|
-
|
22
|
-
def test_merge_recursive_clone3
|
23
|
-
h1 = {'k1' => 1, 'k2' => {'sk1' => 1}}
|
24
|
-
h2 = {'k1' => 2, 'k2' => 2}
|
25
|
-
|
26
|
-
assert_equal({'k1' => 2, 'k2' => 2}, h1.merge_recursive(h2))
|
27
|
-
end
|
28
|
-
|
29
|
-
def test_merge_recursive_clone4
|
30
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
31
|
-
h2 = {'k1' => 2, 'k2' => {'sk2' => 2}}
|
32
|
-
|
33
|
-
assert_equal({'k1' => 2, 'k2' => {'sk2' => 2}}, h1.merge_recursive(h2))
|
34
|
-
end
|
35
|
-
|
36
|
-
def test_merge_recursive_clone5
|
37
|
-
h1 = {'k1' => 1, 'k2' => {'sk1' => 1}}
|
38
|
-
h2 = {'k1' => 2, 'k2' => {'sk2' => 2}}
|
39
|
-
|
40
|
-
assert_equal({'k1' => 2, 'k2' => {'sk1' => 1, 'sk2' => 2}}, h1.merge_recursive(h2))
|
41
|
-
end
|
42
|
-
|
43
|
-
def test_merge_recursive_clone6
|
44
|
-
h1 = {'k1' => 1, 'k2' => 1, 'k4' => {'sk1' => 1}}
|
45
|
-
h2 = {'k1' => 2, 'k3' => 2, 'k4' => {'sk2' => 2}}
|
46
|
-
|
47
|
-
assert_equal({'k1' => 2, 'k2' => 1, 'k3' => 2, 'k4' => {'sk1' => 1, 'sk2' => 2}}, h1.merge_recursive(h2))
|
48
|
-
end
|
49
|
-
|
50
|
-
def test_merge_recursive_self1
|
51
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
52
|
-
h2 = {'k1' => 2, 'k2' => 2}
|
53
|
-
|
54
|
-
h1.merge_recursive!(h2)
|
55
|
-
|
56
|
-
assert_equal({'k1' => 2, 'k2' => 2}, h1)
|
57
|
-
end
|
58
|
-
|
59
|
-
def test_merge_recursive_self2
|
60
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
61
|
-
h2 = {'k1' => 2, 'k3' => 2}
|
62
|
-
|
63
|
-
h1.merge_recursive!(h2)
|
64
|
-
|
65
|
-
assert_equal({'k1' => 2, 'k2' => 1, 'k3' => 2}, h1)
|
66
|
-
end
|
67
|
-
|
68
|
-
def test_merge_recursive_self3
|
69
|
-
h1 = {'k1' => 1, 'k2' => {'sk1' => 1}}
|
70
|
-
h2 = {'k1' => 2, 'k2' => 2}
|
71
|
-
|
72
|
-
h1.merge_recursive!(h2)
|
73
|
-
|
74
|
-
assert_equal({'k1' => 2, 'k2' => 2}, h1)
|
75
|
-
end
|
76
|
-
|
77
|
-
def test_merge_recursive_self4
|
78
|
-
h1 = {'k1' => 1, 'k2' => 1}
|
79
|
-
h2 = {'k1' => 2, 'k2' => {'sk2' => 2}}
|
80
|
-
|
81
|
-
h1.merge_recursive!(h2)
|
82
|
-
|
83
|
-
assert_equal({'k1' => 2, 'k2' => {'sk2' => 2}}, h1)
|
84
|
-
end
|
85
|
-
|
86
|
-
def test_merge_recursive_self5
|
87
|
-
h1 = {'k1' => 1, 'k2' => {'sk1' => 1}}
|
88
|
-
h2 = {'k1' => 2, 'k2' => {'sk2' => 2}}
|
89
|
-
|
90
|
-
h1.merge_recursive!(h2)
|
91
|
-
|
92
|
-
assert_equal({'k1' => 2, 'k2' => {'sk1' => 1, 'sk2' => 2}}, h1)
|
93
|
-
end
|
94
|
-
|
95
|
-
def test_merge_recursive_self6
|
96
|
-
h1 = {'k1' => 1, 'k2' => 1, 'k4' => {'sk1' => 1}}
|
97
|
-
h2 = {'k1' => 2, 'k3' => 2, 'k4' => {'sk2' => 2}}
|
98
|
-
|
99
|
-
h1.merge_recursive!(h2)
|
100
|
-
|
101
|
-
assert_equal({'k1' => 2, 'k2' => 1, 'k3' => 2, 'k4' => {'sk1' => 1, 'sk2' => 2}}, h1)
|
102
|
-
end
|
103
|
-
end
|
data/tests/tc_integer.rb
DELETED
@@ -1,20 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'minitest/autorun'
|
4
|
-
require 'thefox-ext'
|
5
|
-
|
6
|
-
|
7
|
-
class TestInteger < MiniTest::Test
|
8
|
-
def test_to_b
|
9
|
-
assert_equal(true, 3.to_b)
|
10
|
-
assert_equal(true, 2.to_b)
|
11
|
-
assert_equal(true, 1.to_b)
|
12
|
-
|
13
|
-
assert_equal(false, 0.to_b)
|
14
|
-
|
15
|
-
assert_equal(true, -1.to_b)
|
16
|
-
assert_equal(true, -2.to_b)
|
17
|
-
assert_equal(true, -3.to_b)
|
18
|
-
|
19
|
-
end
|
20
|
-
end
|