coercible 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +18 -0
- data/.rspec +2 -0
- data/.travis.yml +19 -0
- data/Changelog.md +4 -0
- data/Gemfile +6 -0
- data/Gemfile.devtools +44 -0
- data/Guardfile +58 -0
- data/LICENSE.txt +22 -0
- data/README.md +64 -0
- data/Rakefile +2 -0
- data/coercible.gemspec +22 -0
- data/config/flay.yml +3 -0
- data/config/flog.yml +2 -0
- data/config/mutant.yml +3 -0
- data/config/roodi.yml +17 -0
- data/config/site.reek +91 -0
- data/config/yardstick.yml +2 -0
- data/lib/coercible.rb +42 -0
- data/lib/coercible/coercer.rb +155 -0
- data/lib/coercible/coercer/array.rb +24 -0
- data/lib/coercible/coercer/configurable.rb +54 -0
- data/lib/coercible/coercer/date.rb +27 -0
- data/lib/coercible/coercer/date_time.rb +27 -0
- data/lib/coercible/coercer/decimal.rb +41 -0
- data/lib/coercible/coercer/false_class.rb +25 -0
- data/lib/coercible/coercer/float.rb +40 -0
- data/lib/coercible/coercer/hash.rb +72 -0
- data/lib/coercible/coercer/integer.rb +130 -0
- data/lib/coercible/coercer/numeric.rb +67 -0
- data/lib/coercible/coercer/object.rb +160 -0
- data/lib/coercible/coercer/string.rb +251 -0
- data/lib/coercible/coercer/symbol.rb +25 -0
- data/lib/coercible/coercer/time.rb +41 -0
- data/lib/coercible/coercer/time_coercions.rb +87 -0
- data/lib/coercible/coercer/true_class.rb +25 -0
- data/lib/coercible/configuration.rb +33 -0
- data/lib/coercible/version.rb +3 -0
- data/lib/support/options.rb +113 -0
- data/lib/support/type_lookup.rb +113 -0
- data/spec/integration/configuring_coercers_spec.rb +14 -0
- data/spec/shared/unit/configurable.rb +27 -0
- data/spec/spec_helper.rb +30 -0
- data/spec/unit/coercible/coercer/array/to_set_spec.rb +12 -0
- data/spec/unit/coercible/coercer/class_methods/new_spec.rb +13 -0
- data/spec/unit/coercible/coercer/date/to_date_spec.rb +10 -0
- data/spec/unit/coercible/coercer/date/to_datetime_spec.rb +30 -0
- data/spec/unit/coercible/coercer/date/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/date/to_time_spec.rb +12 -0
- data/spec/unit/coercible/coercer/date_time/to_date_spec.rb +30 -0
- data/spec/unit/coercible/coercer/date_time/to_datetime_spec.rb +10 -0
- data/spec/unit/coercible/coercer/date_time/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/date_time/to_time_spec.rb +30 -0
- data/spec/unit/coercible/coercer/decimal/to_decimal_spec.rb +9 -0
- data/spec/unit/coercible/coercer/decimal/to_float_spec.rb +12 -0
- data/spec/unit/coercible/coercer/decimal/to_integer_spec.rb +12 -0
- data/spec/unit/coercible/coercer/decimal/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/element_reference_spec.rb +19 -0
- data/spec/unit/coercible/coercer/false_class/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/float/to_decimal_spec.rb +12 -0
- data/spec/unit/coercible/coercer/float/to_float_spec.rb +9 -0
- data/spec/unit/coercible/coercer/float/to_integer_spec.rb +12 -0
- data/spec/unit/coercible/coercer/float/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/hash/to_date_spec.rb +38 -0
- data/spec/unit/coercible/coercer/hash/to_datetime_spec.rb +38 -0
- data/spec/unit/coercible/coercer/hash/to_time_spec.rb +38 -0
- data/spec/unit/coercible/coercer/integer/to_boolean_spec.rb +27 -0
- data/spec/unit/coercible/coercer/integer/to_decimal_spec.rb +12 -0
- data/spec/unit/coercible/coercer/integer/to_float_spec.rb +12 -0
- data/spec/unit/coercible/coercer/integer/to_integer_spec.rb +9 -0
- data/spec/unit/coercible/coercer/integer/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/integer_spec.rb +11 -0
- data/spec/unit/coercible/coercer/numeric/to_decimal_spec.rb +10 -0
- data/spec/unit/coercible/coercer/numeric/to_float_spec.rb +10 -0
- data/spec/unit/coercible/coercer/numeric/to_integer_spec.rb +10 -0
- data/spec/unit/coercible/coercer/numeric/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/object/to_array_spec.rb +51 -0
- data/spec/unit/coercible/coercer/object/to_hash_spec.rb +22 -0
- data/spec/unit/coercible/coercer/object/to_integer_spec.rb +22 -0
- data/spec/unit/coercible/coercer/object/to_string_spec.rb +22 -0
- data/spec/unit/coercible/coercer/string/to_boolean_spec.rb +31 -0
- data/spec/unit/coercible/coercer/string/to_constant_spec.rb +49 -0
- data/spec/unit/coercible/coercer/string/to_date_spec.rb +25 -0
- data/spec/unit/coercible/coercer/string/to_datetime_spec.rb +52 -0
- data/spec/unit/coercible/coercer/string/to_decimal_spec.rb +47 -0
- data/spec/unit/coercible/coercer/string/to_float_spec.rb +57 -0
- data/spec/unit/coercible/coercer/string/to_integer_spec.rb +68 -0
- data/spec/unit/coercible/coercer/string/to_symbol_spec.rb +9 -0
- data/spec/unit/coercible/coercer/string/to_time_spec.rb +52 -0
- data/spec/unit/coercible/coercer/string_spec.rb +11 -0
- data/spec/unit/coercible/coercer/symbol/to_string_spec.rb +12 -0
- data/spec/unit/coercible/coercer/time/to_integer_spec.rb +10 -0
- data/spec/unit/coercible/coercer/time/to_time_spec.rb +10 -0
- data/spec/unit/coercible/coercer/time_coercions/to_date_spec.rb +30 -0
- data/spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb +34 -0
- data/spec/unit/coercible/coercer/time_coercions/to_string_spec.rb +19 -0
- data/spec/unit/coercible/coercer/time_coercions/to_time_spec.rb +34 -0
- data/spec/unit/coercible/coercer/true_class/to_string_spec.rb +12 -0
- data/spec/unit/coercible/configuration/class_methods/build_spec.rb +15 -0
- metadata +235 -0
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::String, '.to_decimal' do
|
4
|
+
subject { object.to_decimal(string) }
|
5
|
+
|
6
|
+
let(:object) { described_class.new }
|
7
|
+
|
8
|
+
{
|
9
|
+
'1' => BigDecimal('1.0'),
|
10
|
+
'+1' => BigDecimal('1.0'),
|
11
|
+
'-1' => BigDecimal('-1.0'),
|
12
|
+
'1.0' => BigDecimal('1.0'),
|
13
|
+
'1.0e+1' => BigDecimal('10.0'),
|
14
|
+
'1.0e-1' => BigDecimal('0.1'),
|
15
|
+
'1.0E+1' => BigDecimal('10.0'),
|
16
|
+
'1.0E-1' => BigDecimal('0.1'),
|
17
|
+
'+1.0' => BigDecimal('1.0'),
|
18
|
+
'+1.0e+1' => BigDecimal('10.0'),
|
19
|
+
'+1.0e-1' => BigDecimal('0.1'),
|
20
|
+
'+1.0E+1' => BigDecimal('10.0'),
|
21
|
+
'+1.0E-1' => BigDecimal('0.1'),
|
22
|
+
'-1.0' => BigDecimal('-1.0'),
|
23
|
+
'-1.0e+1' => BigDecimal('-10.0'),
|
24
|
+
'-1.0e-1' => BigDecimal('-0.1'),
|
25
|
+
'-1.0E+1' => BigDecimal('-10.0'),
|
26
|
+
'-1.0E-1' => BigDecimal('-0.1'),
|
27
|
+
'.1' => BigDecimal('0.1'),
|
28
|
+
'.1e+1' => BigDecimal('1.0'),
|
29
|
+
'.1e-1' => BigDecimal('0.01'),
|
30
|
+
'.1E+1' => BigDecimal('1.0'),
|
31
|
+
'.1E-1' => BigDecimal('0.01'),
|
32
|
+
}.each do |value, expected|
|
33
|
+
context "with #{value.inspect}" do
|
34
|
+
let(:string) { value }
|
35
|
+
|
36
|
+
it { should be_instance_of(BigDecimal) }
|
37
|
+
|
38
|
+
it { should eql(expected) }
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
context 'with an invalid decimal string' do
|
43
|
+
let(:string) { 'non-decimal' }
|
44
|
+
|
45
|
+
it { should equal(string) }
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::String, '.to_float' do
|
4
|
+
subject { described_class.new.to_float(string) }
|
5
|
+
|
6
|
+
{
|
7
|
+
'1' => 1.0,
|
8
|
+
'+1' => 1.0,
|
9
|
+
'-1' => -1.0,
|
10
|
+
'1.0' => 1.0,
|
11
|
+
'1.0e+1' => 10.0,
|
12
|
+
'1.0e-1' => 0.1,
|
13
|
+
'1.0E+1' => 10.0,
|
14
|
+
'1.0E-1' => 0.1,
|
15
|
+
'+1.0' => 1.0,
|
16
|
+
'+1.0e+1' => 10.0,
|
17
|
+
'+1.0e-1' => 0.1,
|
18
|
+
'+1.0E+1' => 10.0,
|
19
|
+
'+1.0E-1' => 0.1,
|
20
|
+
'-1.0' => -1.0,
|
21
|
+
'-1.0e+1' => -10.0,
|
22
|
+
'-1.0e-1' => -0.1,
|
23
|
+
'-1.0E+1' => -10.0,
|
24
|
+
'-1.0E-1' => -0.1,
|
25
|
+
'.1' => 0.1,
|
26
|
+
'.1e+1' => 1.0,
|
27
|
+
'.1e-1' => 0.01,
|
28
|
+
'.1E+1' => 1.0,
|
29
|
+
'.1E-1' => 0.01,
|
30
|
+
'1e1' => 10.0,
|
31
|
+
'1E+1' => 10.0,
|
32
|
+
'+1e-1' => 0.1,
|
33
|
+
'-1E1' => -10.0,
|
34
|
+
'-1e-1' => -0.1,
|
35
|
+
}.each do |value, expected|
|
36
|
+
context "with #{value.inspect}" do
|
37
|
+
let(:string) { value }
|
38
|
+
|
39
|
+
it { should be_instance_of(Float) }
|
40
|
+
|
41
|
+
it { should eql(expected) }
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with an invalid float string' do
|
46
|
+
let(:string) { 'non-float' }
|
47
|
+
|
48
|
+
it { should equal(string) }
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'string starts with e' do
|
52
|
+
let(:string) { 'e1' }
|
53
|
+
|
54
|
+
# In further version it will raise exception
|
55
|
+
it { should == 'e1' }
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::String, '.to_integer' do
|
4
|
+
subject { described_class.new.to_integer(string) }
|
5
|
+
|
6
|
+
min_float = Float::MIN
|
7
|
+
max_float = (Float::MAX / 10).to_s.to_f # largest float that can be parsed
|
8
|
+
|
9
|
+
{
|
10
|
+
'1' => 1,
|
11
|
+
'+1' => 1,
|
12
|
+
'-1' => -1,
|
13
|
+
'1.0' => 1,
|
14
|
+
'1.0e+1' => 10,
|
15
|
+
'1.0e-1' => 0,
|
16
|
+
'1.0E+1' => 10,
|
17
|
+
'1.0E-1' => 0,
|
18
|
+
'+1.0' => 1,
|
19
|
+
'+1.0e+1' => 10,
|
20
|
+
'+1.0e-1' => 0,
|
21
|
+
'+1.0E+1' => 10,
|
22
|
+
'+1.0E-1' => 0,
|
23
|
+
'-1.0' => -1,
|
24
|
+
'-1.0e+1' => -10,
|
25
|
+
'-1.0e-1' => 0,
|
26
|
+
'-1.0E+1' => -10,
|
27
|
+
'-1.0E-1' => 0,
|
28
|
+
'.1' => 0,
|
29
|
+
'.1e+1' => 1,
|
30
|
+
'.1e-1' => 0,
|
31
|
+
'.1E+1' => 1,
|
32
|
+
'.1E-1' => 0,
|
33
|
+
'1e1' => 10,
|
34
|
+
'1E+1' => 10,
|
35
|
+
'+1e-1' => 0,
|
36
|
+
'-1E1' => -10,
|
37
|
+
'-1e-1' => 0,
|
38
|
+
min_float.to_s => min_float.to_i,
|
39
|
+
max_float.to_s => max_float.to_i,
|
40
|
+
}.each do |value, expected|
|
41
|
+
context "with #{value.inspect}" do
|
42
|
+
let(:string) { value }
|
43
|
+
|
44
|
+
it { should be_kind_of(Integer) }
|
45
|
+
|
46
|
+
it { should eql(expected) }
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
context 'with an invalid integer string' do
|
51
|
+
let(:string) { 'non-integer' }
|
52
|
+
|
53
|
+
it { should equal(string) }
|
54
|
+
end
|
55
|
+
|
56
|
+
context 'when integer string is big' do
|
57
|
+
let(:string) { '334490140000101135' }
|
58
|
+
|
59
|
+
it { should == 334490140000101135 }
|
60
|
+
end
|
61
|
+
|
62
|
+
context 'string starts with e' do
|
63
|
+
let(:string) { 'e1' }
|
64
|
+
|
65
|
+
# In further version it will raise exception
|
66
|
+
it { should == 'e1' }
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
shared_examples_for 'a correct time object' do
|
4
|
+
it { should be_instance_of(Time) }
|
5
|
+
|
6
|
+
its(:year) { should == year }
|
7
|
+
its(:month) { should == month }
|
8
|
+
its(:day) { should == day }
|
9
|
+
its(:hour) { should == hour }
|
10
|
+
its(:min) { should == min }
|
11
|
+
its(:sec) { should == sec }
|
12
|
+
end
|
13
|
+
|
14
|
+
describe Coercer::String, '.to_time' do
|
15
|
+
subject { object.to_time(string) }
|
16
|
+
|
17
|
+
let(:object) { described_class.new }
|
18
|
+
|
19
|
+
context 'with a valid time string' do
|
20
|
+
let(:year) { 2011 }
|
21
|
+
let(:month) { 7 }
|
22
|
+
let(:day) { 22 }
|
23
|
+
|
24
|
+
context 'not including time part' do
|
25
|
+
let(:string) { "July, #{day}th, #{year}" }
|
26
|
+
|
27
|
+
let(:hour) { 0 }
|
28
|
+
let(:min) { 0 }
|
29
|
+
let(:sec) { 0 }
|
30
|
+
|
31
|
+
it_should_behave_like 'a correct time object'
|
32
|
+
end
|
33
|
+
|
34
|
+
context 'including time part' do
|
35
|
+
let(:string) { "July, #{day}, #{year}, #{hour}:#{min}:#{sec}" }
|
36
|
+
|
37
|
+
let(:hour) { 13 }
|
38
|
+
let(:min) { 44 }
|
39
|
+
let(:sec) { 50 }
|
40
|
+
|
41
|
+
it_should_behave_like 'a correct time object'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
context 'with an invalid date time string' do
|
46
|
+
let(:string) { '2999' }
|
47
|
+
|
48
|
+
specify do
|
49
|
+
expect { subject }.to raise_error(UnsupportedCoercion)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
@@ -0,0 +1,30 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::TimeCoercions, '.to_date' do
|
4
|
+
subject { object.to_date(value) }
|
5
|
+
|
6
|
+
let(:object) { coercer.new }
|
7
|
+
let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } }
|
8
|
+
let(:value) { mock('value') }
|
9
|
+
|
10
|
+
context 'when the value responds to #to_date' do
|
11
|
+
before do
|
12
|
+
value.should_receive(:to_date).and_return(Date.new(2011, 1, 1))
|
13
|
+
end
|
14
|
+
|
15
|
+
it { should be_instance_of(Date) }
|
16
|
+
|
17
|
+
it { should eql(Date.new(2011, 1, 1)) }
|
18
|
+
end
|
19
|
+
|
20
|
+
context 'when the value does not respond to #to_date' do
|
21
|
+
before do
|
22
|
+
# use a string that Date.parse can handle
|
23
|
+
value.should_receive(:to_s).and_return('2011-01-01')
|
24
|
+
end
|
25
|
+
|
26
|
+
it { should be_instance_of(Date) }
|
27
|
+
|
28
|
+
it { should eql(Date.new(2011, 1, 1)) }
|
29
|
+
end
|
30
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::TimeCoercions, '.to_datetime' do
|
4
|
+
subject { object.to_datetime(value) }
|
5
|
+
|
6
|
+
let(:object) { coercer.new }
|
7
|
+
let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } }
|
8
|
+
let(:value) { mock('value') }
|
9
|
+
|
10
|
+
context 'when the value responds to #to_datetime' do
|
11
|
+
before do
|
12
|
+
object.extend Coercer::TimeCoercions
|
13
|
+
|
14
|
+
value.should_receive(:to_datetime).and_return(DateTime.new(2011, 1, 1, 0, 0, 0))
|
15
|
+
end
|
16
|
+
|
17
|
+
it { should be_instance_of(DateTime) }
|
18
|
+
|
19
|
+
it { should eql(DateTime.new(2011, 1, 1, 0, 0, 0)) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when the value does not respond to #to_datetime' do
|
23
|
+
before do
|
24
|
+
object.extend Coercer::TimeCoercions
|
25
|
+
|
26
|
+
# use a string that DateTime.parse can handle
|
27
|
+
value.should_receive(:to_s).and_return('2011-01-01T00:00:00+00:00')
|
28
|
+
end
|
29
|
+
|
30
|
+
it { should be_instance_of(DateTime) }
|
31
|
+
|
32
|
+
it { should eql(DateTime.new(2011, 1, 1, 0, 0, 0)) }
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::TimeCoercions, '.to_string' do
|
4
|
+
subject { object.to_string(value) }
|
5
|
+
|
6
|
+
let(:object) { coercer.new }
|
7
|
+
let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } }
|
8
|
+
let(:value) { mock('value') }
|
9
|
+
|
10
|
+
before do
|
11
|
+
object.extend Coercer::TimeCoercions
|
12
|
+
|
13
|
+
value.should_receive(:to_s).and_return('2011-01-01')
|
14
|
+
end
|
15
|
+
|
16
|
+
it { should be_instance_of(String) }
|
17
|
+
|
18
|
+
it { should eql('2011-01-01') }
|
19
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::TimeCoercions, '.to_time' do
|
4
|
+
subject { object.to_time(value) }
|
5
|
+
|
6
|
+
let(:object) { coercer.new }
|
7
|
+
let(:coercer) { Class.new(Coercer::Object) { include Coercer::TimeCoercions } }
|
8
|
+
let(:value) { mock('value') }
|
9
|
+
|
10
|
+
context 'when the value responds to #to_time' do
|
11
|
+
before do
|
12
|
+
object.extend Coercer::TimeCoercions
|
13
|
+
|
14
|
+
value.should_receive(:to_time).and_return(Time.utc(2011, 1, 1))
|
15
|
+
end
|
16
|
+
|
17
|
+
it { should be_instance_of(Time) }
|
18
|
+
|
19
|
+
it { should eql(Time.utc(2011, 1, 1)) }
|
20
|
+
end
|
21
|
+
|
22
|
+
context 'when the value does not respond to #to_time' do
|
23
|
+
before do
|
24
|
+
object.extend Coercer::TimeCoercions
|
25
|
+
|
26
|
+
# use a string that Time.parse can handle
|
27
|
+
value.should_receive(:to_s).and_return('Sat Jan 01 00:00:00 UTC 2011')
|
28
|
+
end
|
29
|
+
|
30
|
+
it { should be_instance_of(Time) }
|
31
|
+
|
32
|
+
it { should eql(Time.utc(2011, 1, 1)) }
|
33
|
+
end
|
34
|
+
end
|
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Coercer::TrueClass, '.to_string' do
|
4
|
+
subject { object.to_string(true_class) }
|
5
|
+
|
6
|
+
let(:object) { described_class.new }
|
7
|
+
let(:true_class) { true }
|
8
|
+
|
9
|
+
it { should be_instance_of(String) }
|
10
|
+
|
11
|
+
it { should eql('true') }
|
12
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Configuration, '.build' do
|
4
|
+
subject { described_class.build(keys) }
|
5
|
+
|
6
|
+
let(:keys) { [ :foo, :bar ] }
|
7
|
+
|
8
|
+
it { should be_instance_of(described_class) }
|
9
|
+
|
10
|
+
it { should respond_to(:foo) }
|
11
|
+
it { should respond_to(:foo=) }
|
12
|
+
|
13
|
+
it { should respond_to(:bar) }
|
14
|
+
it { should respond_to(:bar=) }
|
15
|
+
end
|
metadata
ADDED
@@ -0,0 +1,235 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: coercible
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Piotr Solnica
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2012-12-25 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: backports
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ~>
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '2.6'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '2.6'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: descendants_tracker
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ~>
|
36
|
+
- !ruby/object:Gem::Version
|
37
|
+
version: 0.0.1
|
38
|
+
type: :runtime
|
39
|
+
prerelease: false
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ~>
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.0.1
|
46
|
+
description: Powerful, flexible and configurable coercion library. And nothing more.
|
47
|
+
email:
|
48
|
+
- piotr.solnica@gmail.com
|
49
|
+
executables: []
|
50
|
+
extensions: []
|
51
|
+
extra_rdoc_files: []
|
52
|
+
files:
|
53
|
+
- .gitignore
|
54
|
+
- .rspec
|
55
|
+
- .travis.yml
|
56
|
+
- Changelog.md
|
57
|
+
- Gemfile
|
58
|
+
- Gemfile.devtools
|
59
|
+
- Guardfile
|
60
|
+
- LICENSE.txt
|
61
|
+
- README.md
|
62
|
+
- Rakefile
|
63
|
+
- coercible.gemspec
|
64
|
+
- config/flay.yml
|
65
|
+
- config/flog.yml
|
66
|
+
- config/mutant.yml
|
67
|
+
- config/roodi.yml
|
68
|
+
- config/site.reek
|
69
|
+
- config/yardstick.yml
|
70
|
+
- lib/coercible.rb
|
71
|
+
- lib/coercible/coercer.rb
|
72
|
+
- lib/coercible/coercer/array.rb
|
73
|
+
- lib/coercible/coercer/configurable.rb
|
74
|
+
- lib/coercible/coercer/date.rb
|
75
|
+
- lib/coercible/coercer/date_time.rb
|
76
|
+
- lib/coercible/coercer/decimal.rb
|
77
|
+
- lib/coercible/coercer/false_class.rb
|
78
|
+
- lib/coercible/coercer/float.rb
|
79
|
+
- lib/coercible/coercer/hash.rb
|
80
|
+
- lib/coercible/coercer/integer.rb
|
81
|
+
- lib/coercible/coercer/numeric.rb
|
82
|
+
- lib/coercible/coercer/object.rb
|
83
|
+
- lib/coercible/coercer/string.rb
|
84
|
+
- lib/coercible/coercer/symbol.rb
|
85
|
+
- lib/coercible/coercer/time.rb
|
86
|
+
- lib/coercible/coercer/time_coercions.rb
|
87
|
+
- lib/coercible/coercer/true_class.rb
|
88
|
+
- lib/coercible/configuration.rb
|
89
|
+
- lib/coercible/version.rb
|
90
|
+
- lib/support/options.rb
|
91
|
+
- lib/support/type_lookup.rb
|
92
|
+
- spec/integration/configuring_coercers_spec.rb
|
93
|
+
- spec/shared/unit/configurable.rb
|
94
|
+
- spec/spec_helper.rb
|
95
|
+
- spec/unit/coercible/coercer/array/to_set_spec.rb
|
96
|
+
- spec/unit/coercible/coercer/class_methods/new_spec.rb
|
97
|
+
- spec/unit/coercible/coercer/date/to_date_spec.rb
|
98
|
+
- spec/unit/coercible/coercer/date/to_datetime_spec.rb
|
99
|
+
- spec/unit/coercible/coercer/date/to_string_spec.rb
|
100
|
+
- spec/unit/coercible/coercer/date/to_time_spec.rb
|
101
|
+
- spec/unit/coercible/coercer/date_time/to_date_spec.rb
|
102
|
+
- spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
|
103
|
+
- spec/unit/coercible/coercer/date_time/to_string_spec.rb
|
104
|
+
- spec/unit/coercible/coercer/date_time/to_time_spec.rb
|
105
|
+
- spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
|
106
|
+
- spec/unit/coercible/coercer/decimal/to_float_spec.rb
|
107
|
+
- spec/unit/coercible/coercer/decimal/to_integer_spec.rb
|
108
|
+
- spec/unit/coercible/coercer/decimal/to_string_spec.rb
|
109
|
+
- spec/unit/coercible/coercer/element_reference_spec.rb
|
110
|
+
- spec/unit/coercible/coercer/false_class/to_string_spec.rb
|
111
|
+
- spec/unit/coercible/coercer/float/to_decimal_spec.rb
|
112
|
+
- spec/unit/coercible/coercer/float/to_float_spec.rb
|
113
|
+
- spec/unit/coercible/coercer/float/to_integer_spec.rb
|
114
|
+
- spec/unit/coercible/coercer/float/to_string_spec.rb
|
115
|
+
- spec/unit/coercible/coercer/hash/to_date_spec.rb
|
116
|
+
- spec/unit/coercible/coercer/hash/to_datetime_spec.rb
|
117
|
+
- spec/unit/coercible/coercer/hash/to_time_spec.rb
|
118
|
+
- spec/unit/coercible/coercer/integer/to_boolean_spec.rb
|
119
|
+
- spec/unit/coercible/coercer/integer/to_decimal_spec.rb
|
120
|
+
- spec/unit/coercible/coercer/integer/to_float_spec.rb
|
121
|
+
- spec/unit/coercible/coercer/integer/to_integer_spec.rb
|
122
|
+
- spec/unit/coercible/coercer/integer/to_string_spec.rb
|
123
|
+
- spec/unit/coercible/coercer/integer_spec.rb
|
124
|
+
- spec/unit/coercible/coercer/numeric/to_decimal_spec.rb
|
125
|
+
- spec/unit/coercible/coercer/numeric/to_float_spec.rb
|
126
|
+
- spec/unit/coercible/coercer/numeric/to_integer_spec.rb
|
127
|
+
- spec/unit/coercible/coercer/numeric/to_string_spec.rb
|
128
|
+
- spec/unit/coercible/coercer/object/to_array_spec.rb
|
129
|
+
- spec/unit/coercible/coercer/object/to_hash_spec.rb
|
130
|
+
- spec/unit/coercible/coercer/object/to_integer_spec.rb
|
131
|
+
- spec/unit/coercible/coercer/object/to_string_spec.rb
|
132
|
+
- spec/unit/coercible/coercer/string/to_boolean_spec.rb
|
133
|
+
- spec/unit/coercible/coercer/string/to_constant_spec.rb
|
134
|
+
- spec/unit/coercible/coercer/string/to_date_spec.rb
|
135
|
+
- spec/unit/coercible/coercer/string/to_datetime_spec.rb
|
136
|
+
- spec/unit/coercible/coercer/string/to_decimal_spec.rb
|
137
|
+
- spec/unit/coercible/coercer/string/to_float_spec.rb
|
138
|
+
- spec/unit/coercible/coercer/string/to_integer_spec.rb
|
139
|
+
- spec/unit/coercible/coercer/string/to_symbol_spec.rb
|
140
|
+
- spec/unit/coercible/coercer/string/to_time_spec.rb
|
141
|
+
- spec/unit/coercible/coercer/string_spec.rb
|
142
|
+
- spec/unit/coercible/coercer/symbol/to_string_spec.rb
|
143
|
+
- spec/unit/coercible/coercer/time/to_integer_spec.rb
|
144
|
+
- spec/unit/coercible/coercer/time/to_time_spec.rb
|
145
|
+
- spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
|
146
|
+
- spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
|
147
|
+
- spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
|
148
|
+
- spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
|
149
|
+
- spec/unit/coercible/coercer/true_class/to_string_spec.rb
|
150
|
+
- spec/unit/coercible/configuration/class_methods/build_spec.rb
|
151
|
+
homepage: https://github.com/solnic/coercible
|
152
|
+
licenses: []
|
153
|
+
post_install_message:
|
154
|
+
rdoc_options: []
|
155
|
+
require_paths:
|
156
|
+
- lib
|
157
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
none: false
|
159
|
+
requirements:
|
160
|
+
- - ! '>='
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: '0'
|
163
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
164
|
+
none: false
|
165
|
+
requirements:
|
166
|
+
- - ! '>='
|
167
|
+
- !ruby/object:Gem::Version
|
168
|
+
version: '0'
|
169
|
+
requirements: []
|
170
|
+
rubyforge_project:
|
171
|
+
rubygems_version: 1.8.24
|
172
|
+
signing_key:
|
173
|
+
specification_version: 3
|
174
|
+
summary: Powerful, flexible and configurable coercion library. And nothing more.
|
175
|
+
test_files:
|
176
|
+
- spec/integration/configuring_coercers_spec.rb
|
177
|
+
- spec/shared/unit/configurable.rb
|
178
|
+
- spec/spec_helper.rb
|
179
|
+
- spec/unit/coercible/coercer/array/to_set_spec.rb
|
180
|
+
- spec/unit/coercible/coercer/class_methods/new_spec.rb
|
181
|
+
- spec/unit/coercible/coercer/date/to_date_spec.rb
|
182
|
+
- spec/unit/coercible/coercer/date/to_datetime_spec.rb
|
183
|
+
- spec/unit/coercible/coercer/date/to_string_spec.rb
|
184
|
+
- spec/unit/coercible/coercer/date/to_time_spec.rb
|
185
|
+
- spec/unit/coercible/coercer/date_time/to_date_spec.rb
|
186
|
+
- spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
|
187
|
+
- spec/unit/coercible/coercer/date_time/to_string_spec.rb
|
188
|
+
- spec/unit/coercible/coercer/date_time/to_time_spec.rb
|
189
|
+
- spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
|
190
|
+
- spec/unit/coercible/coercer/decimal/to_float_spec.rb
|
191
|
+
- spec/unit/coercible/coercer/decimal/to_integer_spec.rb
|
192
|
+
- spec/unit/coercible/coercer/decimal/to_string_spec.rb
|
193
|
+
- spec/unit/coercible/coercer/element_reference_spec.rb
|
194
|
+
- spec/unit/coercible/coercer/false_class/to_string_spec.rb
|
195
|
+
- spec/unit/coercible/coercer/float/to_decimal_spec.rb
|
196
|
+
- spec/unit/coercible/coercer/float/to_float_spec.rb
|
197
|
+
- spec/unit/coercible/coercer/float/to_integer_spec.rb
|
198
|
+
- spec/unit/coercible/coercer/float/to_string_spec.rb
|
199
|
+
- spec/unit/coercible/coercer/hash/to_date_spec.rb
|
200
|
+
- spec/unit/coercible/coercer/hash/to_datetime_spec.rb
|
201
|
+
- spec/unit/coercible/coercer/hash/to_time_spec.rb
|
202
|
+
- spec/unit/coercible/coercer/integer/to_boolean_spec.rb
|
203
|
+
- spec/unit/coercible/coercer/integer/to_decimal_spec.rb
|
204
|
+
- spec/unit/coercible/coercer/integer/to_float_spec.rb
|
205
|
+
- spec/unit/coercible/coercer/integer/to_integer_spec.rb
|
206
|
+
- spec/unit/coercible/coercer/integer/to_string_spec.rb
|
207
|
+
- spec/unit/coercible/coercer/integer_spec.rb
|
208
|
+
- spec/unit/coercible/coercer/numeric/to_decimal_spec.rb
|
209
|
+
- spec/unit/coercible/coercer/numeric/to_float_spec.rb
|
210
|
+
- spec/unit/coercible/coercer/numeric/to_integer_spec.rb
|
211
|
+
- spec/unit/coercible/coercer/numeric/to_string_spec.rb
|
212
|
+
- spec/unit/coercible/coercer/object/to_array_spec.rb
|
213
|
+
- spec/unit/coercible/coercer/object/to_hash_spec.rb
|
214
|
+
- spec/unit/coercible/coercer/object/to_integer_spec.rb
|
215
|
+
- spec/unit/coercible/coercer/object/to_string_spec.rb
|
216
|
+
- spec/unit/coercible/coercer/string/to_boolean_spec.rb
|
217
|
+
- spec/unit/coercible/coercer/string/to_constant_spec.rb
|
218
|
+
- spec/unit/coercible/coercer/string/to_date_spec.rb
|
219
|
+
- spec/unit/coercible/coercer/string/to_datetime_spec.rb
|
220
|
+
- spec/unit/coercible/coercer/string/to_decimal_spec.rb
|
221
|
+
- spec/unit/coercible/coercer/string/to_float_spec.rb
|
222
|
+
- spec/unit/coercible/coercer/string/to_integer_spec.rb
|
223
|
+
- spec/unit/coercible/coercer/string/to_symbol_spec.rb
|
224
|
+
- spec/unit/coercible/coercer/string/to_time_spec.rb
|
225
|
+
- spec/unit/coercible/coercer/string_spec.rb
|
226
|
+
- spec/unit/coercible/coercer/symbol/to_string_spec.rb
|
227
|
+
- spec/unit/coercible/coercer/time/to_integer_spec.rb
|
228
|
+
- spec/unit/coercible/coercer/time/to_time_spec.rb
|
229
|
+
- spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
|
230
|
+
- spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
|
231
|
+
- spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
|
232
|
+
- spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
|
233
|
+
- spec/unit/coercible/coercer/true_class/to_string_spec.rb
|
234
|
+
- spec/unit/coercible/configuration/class_methods/build_spec.rb
|
235
|
+
has_rdoc:
|