lazier 3.5.1 → 3.5.2
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 +4 -4
- data/.gitignore +4 -0
- data/.rubocop.yml +29 -0
- data/.travis-gemfile +1 -1
- data/.travis.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +3 -3
- data/README.md +1 -1
- data/doc/Lazier.html +56 -68
- data/doc/Lazier/Boolean.html +4 -4
- data/doc/Lazier/Configuration.html +5 -5
- data/doc/Lazier/DateTime.html +29 -29
- data/doc/Lazier/DateTime/ClassMethods.html +136 -124
- data/doc/Lazier/Exceptions.html +4 -4
- data/doc/Lazier/Exceptions/Debug.html +4 -4
- data/doc/Lazier/Exceptions/MissingTranslation.html +4 -4
- data/doc/Lazier/Hash.html +144 -32
- data/doc/Lazier/I18n.html +109 -103
- data/doc/Lazier/Localizer.html +4 -4
- data/doc/Lazier/Math.html +4 -4
- data/doc/Lazier/Math/ClassMethods.html +4 -4
- data/doc/Lazier/Object.html +357 -243
- data/doc/Lazier/Pathname.html +4 -4
- data/doc/Lazier/Settings.html +58 -34
- data/doc/Lazier/String.html +6 -6
- data/doc/Lazier/TimeZone.html +86 -86
- data/doc/Lazier/TimeZone/ClassMethods.html +66 -68
- data/doc/Lazier/Version.html +5 -5
- data/doc/_index.html +5 -5
- data/doc/css/style.css +1 -0
- data/doc/file.README.html +4 -4
- data/doc/frames.html +1 -1
- data/doc/index.html +4 -4
- data/doc/method_list.html +103 -91
- data/doc/top-level-namespace.html +4 -4
- data/lazier.gemspec +2 -2
- data/lib/lazier.rb +59 -22
- data/lib/lazier/boolean.rb +1 -1
- data/lib/lazier/configuration.rb +21 -20
- data/lib/lazier/datetime.rb +127 -101
- data/lib/lazier/hash.rb +20 -12
- data/lib/lazier/i18n.rb +33 -32
- data/lib/lazier/math.rb +1 -1
- data/lib/lazier/object.rb +102 -56
- data/lib/lazier/pathname.rb +1 -1
- data/lib/lazier/settings.rb +4 -2
- data/lib/lazier/string.rb +3 -3
- data/lib/lazier/version.rb +1 -1
- data/spec/lazier/datetime_spec.rb +1 -1
- data/spec/lazier/hash_spec.rb +2 -2
- data/spec/lazier/object_spec.rb +16 -0
- data/spec/lazier/string_spec.rb +4 -10
- data/spec/lazier_spec.rb +9 -9
- data/spec/spec_helper.rb +1 -1
- metadata +7 -6
data/spec/lazier/hash_spec.rb
CHANGED
@@ -6,7 +6,7 @@
|
|
6
6
|
|
7
7
|
require "spec_helper"
|
8
8
|
|
9
|
-
describe
|
9
|
+
describe Object do
|
10
10
|
subject {
|
11
11
|
rv = {a: 1, "b" => {c: 2, d: {"e" => 3}}}
|
12
12
|
rv.default = 0
|
@@ -43,7 +43,7 @@ describe Lazier::Hash do
|
|
43
43
|
end
|
44
44
|
|
45
45
|
it "should use a custom validator" do
|
46
|
-
expect({a: 1, b: nil, c: 3}.compact
|
46
|
+
expect({a: 1, b: nil, c: 3}.compact{|k, v| v == 1 || k == :c}).to eq({b: nil})
|
47
47
|
end
|
48
48
|
|
49
49
|
it "should not be destructive" do
|
data/spec/lazier/object_spec.rb
CHANGED
@@ -39,6 +39,22 @@ describe Lazier::Object do
|
|
39
39
|
end
|
40
40
|
end
|
41
41
|
|
42
|
+
describe "#is_numeric?" do
|
43
|
+
it "should return true for a valid number" do
|
44
|
+
expect(true.is_numeric?).to be_true
|
45
|
+
expect(false.is_numeric?).to be_true
|
46
|
+
expect(nil.is_numeric?).to be_true
|
47
|
+
expect("123".is_numeric?).to be_true
|
48
|
+
expect("-123".is_numeric?).to be_true
|
49
|
+
expect("+123.45".is_numeric?(Float, ::Lazier::Object::FLOAT_MATCHER)).to be_true
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should return false for a invalid number" do
|
53
|
+
expect("s123".is_numeric?).to be_false
|
54
|
+
expect("123.12".is_numeric?).to be_false
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
42
58
|
describe "#is_integer?" do
|
43
59
|
it "should return true for a valid number" do
|
44
60
|
expect(true.is_integer?).to be_true
|
data/spec/lazier/string_spec.rb
CHANGED
@@ -23,16 +23,10 @@ describe Lazier::String do
|
|
23
23
|
end
|
24
24
|
|
25
25
|
describe "#ensure_valid_utf8" do
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
expect("this is invalid - \xEA\xF3\xEF\xE8\xF2\xFC inv \xE2 \xC0\xC2\xD2\xCED\xCE\xCC\xE5 - \xE1\xEC\xE2 3 \xF1\xE5\xF0\xE8\xE8".ensure_valid_utf8("X")).to eq("this is invalid - XXXXXX inv X XXXXDXXX - XXX 3 XXXXX")
|
31
|
-
end
|
32
|
-
else
|
33
|
-
it "raise an exception" do
|
34
|
-
expect { "this is valid".ensure_valid_utf8 }.to raise_error(RuntimeError)
|
35
|
-
end
|
26
|
+
it "converts to a valid UTF-8, leaving valid strings untouched" do
|
27
|
+
expect("this is valid".ensure_valid_utf8).to eq("this is valid")
|
28
|
+
expect("this is invalid - \xEA\xF3\xEF\xE8\xF2\xFC inv \xE2 \xC0\xC2\xD2\xCED\xCE\xCC\xE5 - \xE1\xEC\xE2 3 \xF1\xE5\xF0\xE8\xE8".ensure_valid_utf8).to eq("this is invalid - inv D - 3 ")
|
29
|
+
expect("this is invalid - \xEA\xF3\xEF\xE8\xF2\xFC inv \xE2 \xC0\xC2\xD2\xCED\xCE\xCC\xE5 - \xE1\xEC\xE2 3 \xF1\xE5\xF0\xE8\xE8".ensure_valid_utf8("X")).to eq("this is invalid - XXXXXX inv X XXXXDXXX - XXX 3 XXXXX")
|
36
30
|
end
|
37
31
|
end
|
38
32
|
|
data/spec/lazier_spec.rb
CHANGED
@@ -13,33 +13,33 @@ describe Lazier do
|
|
13
13
|
::Lazier.load!
|
14
14
|
|
15
15
|
it "for Boolean" do
|
16
|
-
expect(true).to respond_to(
|
17
|
-
expect(true).to respond_to(
|
16
|
+
expect(true).to respond_to(:value)
|
17
|
+
expect(true).to respond_to(:to_i)
|
18
18
|
end
|
19
19
|
|
20
20
|
it "for DateTime" do
|
21
|
-
expect(::DateTime).to respond_to(
|
22
|
-
expect(::DateTime.now).to respond_to(
|
21
|
+
expect(::DateTime).to respond_to(:custom_format)
|
22
|
+
expect(::DateTime.now).to respond_to(:lstrftime)
|
23
23
|
end
|
24
24
|
|
25
25
|
it "for Hash" do
|
26
|
-
expect({a: "b"}).to respond_to(
|
26
|
+
expect({a: "b"}).to respond_to(:ensure_access)
|
27
27
|
end
|
28
28
|
|
29
29
|
it "for Math" do
|
30
|
-
expect(::Math).to respond_to(
|
30
|
+
expect(::Math).to respond_to(:min)
|
31
31
|
end
|
32
32
|
|
33
33
|
it "for Object" do
|
34
|
-
expect(0).to respond_to(
|
34
|
+
expect(0).to respond_to(:for_debug)
|
35
35
|
end
|
36
36
|
|
37
37
|
it "for Pathname" do
|
38
|
-
expect(::Pathname.new($0)).to respond_to(
|
38
|
+
expect(::Pathname.new($0)).to respond_to(:components)
|
39
39
|
end
|
40
40
|
|
41
41
|
it "for String" do
|
42
|
-
expect("").to respond_to(
|
42
|
+
expect("").to respond_to(:remove_accents)
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: lazier
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.5.
|
4
|
+
version: 3.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Shogun
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
@@ -58,28 +58,28 @@ dependencies:
|
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 1.1.
|
61
|
+
version: 1.1.10
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 1.1.
|
68
|
+
version: 1.1.10
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: hashie
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.
|
75
|
+
version: 2.1.1
|
76
76
|
type: :runtime
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 2.
|
82
|
+
version: 2.1.1
|
83
83
|
description: Several Ruby object enhancements.
|
84
84
|
email:
|
85
85
|
- shogun@cowtech.it
|
@@ -89,6 +89,7 @@ extra_rdoc_files: []
|
|
89
89
|
files:
|
90
90
|
- ".DS_Store"
|
91
91
|
- ".gitignore"
|
92
|
+
- ".rubocop.yml"
|
92
93
|
- ".travis-gemfile"
|
93
94
|
- ".travis.yml"
|
94
95
|
- ".yardopts"
|