coercible 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. data/.travis.yml +1 -0
  2. data/Changelog.md +4 -0
  3. data/Gemfile +1 -1
  4. data/Gemfile.devtools +43 -22
  5. data/README.md +3 -3
  6. data/coercible.gemspec +1 -1
  7. data/lib/coercible.rb +4 -0
  8. data/lib/coercible/coercer.rb +1 -10
  9. data/lib/coercible/coercer/integer.rb +7 -7
  10. data/lib/coercible/coercer/object.rb +10 -1
  11. data/lib/coercible/version.rb +1 -1
  12. data/spec/shared/unit/coerced_predicate.rb +13 -0
  13. data/spec/spec_helper.rb +8 -5
  14. data/spec/unit/coercible/coercer/array/coerced_predicate_spec.rb +10 -0
  15. data/spec/unit/coercible/coercer/date/coerced_predicate_spec.rb +10 -0
  16. data/spec/unit/coercible/coercer/date_time/coerced_predicate_spec.rb +10 -0
  17. data/spec/unit/coercible/coercer/decimal/coerced_predicate_spec.rb +10 -0
  18. data/spec/unit/coercible/coercer/false_class/coerced_predicate_spec.rb +10 -0
  19. data/spec/unit/coercible/coercer/float/coerced_predicate_spec.rb +10 -0
  20. data/spec/unit/coercible/coercer/float/to_datetime_spec.rb +10 -0
  21. data/spec/unit/coercible/coercer/hash/coerced_predicate_spec.rb +10 -0
  22. data/spec/unit/coercible/coercer/integer/coerced_predicate_spec.rb +10 -0
  23. data/spec/unit/coercible/coercer/integer/datetime_format_spec.rb +27 -0
  24. data/spec/unit/coercible/coercer/integer/datetime_proc_spec.rb +21 -0
  25. data/spec/unit/coercible/coercer/integer/to_datetime_spec.rb +10 -0
  26. data/spec/unit/coercible/coercer/object/coerced_predicate_spec.rb +10 -0
  27. data/spec/unit/coercible/coercer/object/method_missing_spec.rb +20 -0
  28. data/spec/unit/coercible/coercer/string/coerced_predicate_spec.rb +10 -0
  29. data/spec/unit/coercible/coercer/symbol/coerced_predicate_spec.rb +10 -0
  30. data/spec/unit/coercible/coercer/time/coerced_predicate_spec.rb +10 -0
  31. data/spec/unit/coercible/coercer/true_class/coerced_predicate_spec.rb +10 -0
  32. metadata +42 -4
@@ -6,6 +6,7 @@ rvm:
6
6
  - 1.8.7
7
7
  - 1.9.2
8
8
  - 1.9.3
9
+ - 2.0.0
9
10
  - jruby-18mode
10
11
  - jruby-19mode
11
12
  - rbx-18mode
@@ -1,3 +1,7 @@
1
+ # v0.0.2 2013-02-16
2
+
3
+ * [feature] Added Coercer::Object#coerced? (solnic)
4
+
1
5
  # v0.0.1 2012-12-25
2
6
 
3
7
  * Add configurable coercers (solnic)
data/Gemfile CHANGED
@@ -2,5 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  gemspec
4
4
 
5
- gem 'devtools', :git => 'https://github.com/mbj/devtools.git'
5
+ gem 'devtools', :git => 'https://github.com/datamapper/devtools.git'
6
6
  eval File.read('Gemfile.devtools')
@@ -1,44 +1,65 @@
1
+ # encoding: utf-8
2
+
1
3
  group :development do
2
- gem 'rake', '~> 0.9.2'
3
- gem 'rspec', '~> 2.12.0'
4
- gem 'yard', '~> 0.8.3'
4
+ gem 'rake', '~> 10.0.3'
5
+ gem 'rspec', '~> 2.12.0'
6
+ gem 'yard', '~> 0.8.4.1'
7
+ end
8
+
9
+ group :yard do
10
+ gem 'redcarpet', '~> 2.2.2', :platforms => [ :mri, :rbx ]
5
11
  end
6
12
 
7
13
  group :guard do
8
- gem 'guard', '~> 1.5.4'
14
+ gem 'guard', '~> 1.6.2'
9
15
  gem 'guard-bundler', '~> 1.0.0'
10
- gem 'guard-rspec', '~> 2.1.1'
11
- gem 'rb-inotify', :git => 'https://github.com/mbj/rb-inotify'
12
- end
16
+ gem 'guard-rspec', '~> 2.3.3'
13
17
 
14
- group :benchmarks do
15
- gem 'rbench', '~> 0.2.3'
16
- end
18
+ # file system change event handling
19
+ gem 'rb-fchange', '~> 0.0.6', :require => false
20
+ gem 'rb-fsevent', '~> 0.9.3', :require => false
21
+ gem 'rb-inotify', '~> 0.9.0', :require => false
17
22
 
18
- platform :jruby do
19
- group :jruby do
20
- gem 'jruby-openssl', '~> 0.7.4'
21
- end
23
+ # Remove this one https://github.com/guard/listen/pull/78 is released
24
+ gem 'listen', '~> 0.7.2', :git => 'https://github.com/guard/listen.git'
25
+
26
+ # notification handling
27
+ gem 'libnotify', '~> 0.8.0', :require => false
28
+ gem 'rb-notifu', '~> 0.0.4', :require => false
29
+ gem 'terminal-notifier-guard', '~> 1.5.3', :require => false
22
30
  end
23
31
 
24
32
  group :metrics do
25
- gem 'flay', '~> 1.4.2'
26
- gem 'flog', '~> 2.5.1'
27
- gem 'reek', '~> 1.2.8', :git => 'https://github.com/dkubb/reek.git'
28
- gem 'roodi', '~> 2.1.0'
29
- gem 'yardstick', '~> 0.8.0'
30
- gem 'mutant', '~> 0.2.4'
33
+ gem 'flay', '~> 1.4.3'
34
+ gem 'flog', '~> 2.5.3'
35
+ gem 'reek', '~> 1.2.13', :git => 'https://github.com/troessner/reek.git', :ref => 'ef77fcecaa21c9ebcbe4d9a79d41b0e70196bf18'
36
+ gem 'roodi', '~> 2.2.0'
37
+ gem 'yardstick', '~> 0.9.2'
31
38
 
32
39
  platforms :ruby_18, :ruby_19 do
33
40
  # this indirectly depends on ffi which does not build on ruby-head
34
41
  gem 'yard-spellcheck', '~> 0.1.5'
35
42
  end
36
43
 
44
+ platforms :mri_19, :rbx do
45
+ # gem 'mutant', '~> 0.2.16'
46
+ end
47
+
37
48
  platforms :mri_19 do
38
- gem 'simplecov', '~> 0.7'
49
+ gem 'simplecov', '~> 0.7.1'
39
50
  end
40
51
 
41
52
  platforms :rbx do
42
- gem 'pelusa', '~> 0.2.1'
53
+ gem 'pelusa', '~> 0.2.2'
54
+ end
55
+ end
56
+
57
+ group :benchmarks do
58
+ gem 'rbench', '~> 0.2.3'
59
+ end
60
+
61
+ platform :jruby do
62
+ group :jruby do
63
+ gem 'jruby-openssl', '~> 0.8.2'
43
64
  end
44
65
  end
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # Coercible
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/solnic/coercible.png)](http://travis-ci.org/solnic/coercible)
3
+ [![Build Status](https://travis-ci.org/solnic/coercible.png?branch=master)](https://travis-ci.org/solnic/coercible)
4
+ [![Code Climate](https://codeclimate.com/github/solnic/coercible.png)](https://codeclimate.com/github/solnic/coercible)
4
5
  [![Dependency Status](https://gemnasium.com/solnic/coercible.png)](https://gemnasium.com/solnic/coercible)
5
- [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/solnic/coercible)
6
6
 
7
7
  ## Installation
8
8
 
@@ -34,7 +34,7 @@ coercer = Coercible::Coercer.new
34
34
  coercer[String].to_date('2012/12/25') # => #<Date: 4912573/2,0,2299161>
35
35
 
36
36
  # coerce a string to a boolean value
37
- coercer[String].to_string('yes') # => true
37
+ coercer[String].to_boolean('yes') # => true
38
38
 
39
39
  # you got the idea :)
40
40
  ```
@@ -17,6 +17,6 @@ Gem::Specification.new do |gem|
17
17
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
18
18
  gem.require_paths = ["lib"]
19
19
 
20
- gem.add_dependency 'backports', '~> 2.6'
20
+ gem.add_dependency 'backports', '~> 2.8'
21
21
  gem.add_dependency 'descendants_tracker', '~> 0.0.1'
22
22
  end
@@ -2,6 +2,10 @@ module Coercible
2
2
  EXTRA_CONST_ARGS = (RUBY_VERSION < '1.9' ? [] : [ false ]).freeze
3
3
 
4
4
  UnsupportedCoercion = Class.new(StandardError)
5
+
6
+ def self.rbx?
7
+ @is_rbx ||= defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
8
+ end
5
9
  end
6
10
 
7
11
  require 'date'
@@ -100,20 +100,11 @@ module Coercible
100
100
  #
101
101
  # @api public
102
102
  def [](klass)
103
- fetch(klass) || coercers[::Object]
103
+ coercers[klass] || initialize_coercer(klass)
104
104
  end
105
105
 
106
106
  private
107
107
 
108
- # Fetch an existing coercer or create a new instance
109
- #
110
- # @return [Coercer::Object]
111
- #
112
- # @api private
113
- def fetch(klass)
114
- coercers[klass] || initialize_coercer(klass)
115
- end
116
-
117
108
  # Initialize a new coercer instance for the give type
118
109
  #
119
110
  # If a coercer class supports configuration it will receive it from the
@@ -17,14 +17,14 @@ module Coercible
17
17
  #
18
18
  # @api private
19
19
  def self.config
20
- # FIXME: Remove after Rubinius 2.0 is released
21
- is_rbx = defined?(RUBY_ENGINE) && RUBY_ENGINE == 'rbx'
22
-
23
20
  super do |config|
24
- config.datetime_format = is_rbx ? '%Q' : '%s'
25
-
26
- config.datetime_proc = is_rbx ?
27
- Proc.new { |value| "#{value * 10**3}" } : Proc.new { |value| "#{value}" }
21
+ # FIXME: Remove after Rubinius 2.0 is released
22
+ config.datetime_format, config.datetime_proc =
23
+ if Coercible.rbx?
24
+ [ '%Q', Proc.new { |value| "#{value * 10**3}" } ]
25
+ else
26
+ [ '%s', Proc.new { |value| "#{value}" } ]
27
+ end
28
28
 
29
29
  config.boolean_map = { 0 => false, 1 => true }
30
30
  end
@@ -110,6 +110,15 @@ module Coercible
110
110
  coerce_with_method(value, :to_int)
111
111
  end
112
112
 
113
+ # Return if the value was successfuly coerced
114
+ #
115
+ # @return [TrueClass,FalseClass]
116
+ #
117
+ # @api public
118
+ def coerced?(value)
119
+ value.kind_of?(self.class.primitive)
120
+ end
121
+
113
122
  private
114
123
 
115
124
  # Raise an unsupported coercion error
@@ -134,7 +143,7 @@ module Coercible
134
143
  #
135
144
  # @api private
136
145
  def method_missing(method, *args)
137
- if method.to_s =~ COERCION_METHOD_REGEXP and args.size == 1
146
+ if method.to_s =~ COERCION_METHOD_REGEXP && args.size == 1
138
147
  args.first
139
148
  else
140
149
  super
@@ -1,3 +1,3 @@
1
1
  module Coercible
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -0,0 +1,13 @@
1
+ shared_examples_for 'Coercible::Coercer#coerced?' do
2
+ context "with a primitive value" do
3
+ subject { object.coerced?(primitive_value) }
4
+
5
+ it { should be(true) }
6
+ end
7
+
8
+ context "with a non-primitive value" do
9
+ subject { object.coerced?(non_primitive_value) }
10
+
11
+ it { should be(false) }
12
+ end
13
+ end
@@ -1,14 +1,17 @@
1
+ if ENV['COVERAGE']
2
+ require 'simplecov'
3
+ SimpleCov.start do
4
+ add_filter "/spec/"
5
+ add_filter "lib/support"
6
+ end
7
+ end
8
+
1
9
  require 'coercible'
2
10
 
3
11
  include Coercible
4
12
 
5
13
  ENV['TZ'] = 'UTC'
6
14
 
7
- if ENV['COVERAGE']
8
- require 'simplecov'
9
- SimpleCov.start
10
- end
11
-
12
15
  Dir[File.expand_path('../shared/**/*.rb', __FILE__)].each { |file| require file }
13
16
 
14
17
  # This file was generated by the `rspec --init` command. Conventionally, all
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Array, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { [ 1, 2, 3 ] }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Date, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { Date.new }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::DateTime, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { DateTime.new }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Decimal, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { BigDecimal('1.2') }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::FalseClass, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { false }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Float, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { 1.2 }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Float, '#to_float' do
4
+ subject { object.to_datetime(value) }
5
+
6
+ let(:object) { described_class.new }
7
+ let(:value) { 1361036672.12 }
8
+
9
+ it { should be_instance_of(DateTime) }
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Hash, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { Hash.new }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Integer, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { 1 }
8
+ let(:non_primitive_value) { 1.0 }
9
+ end
10
+ end
@@ -0,0 +1,27 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Integer, '#datetime_format' do
4
+ subject { object.datetime_format }
5
+
6
+ let(:object) { described_class.new }
7
+
8
+ context "with Rubinius" do
9
+ before do
10
+ unless Coercible.rbx?
11
+ Coercible.stub!(:rbx? => true)
12
+ end
13
+ end
14
+
15
+ it { should == '%Q' }
16
+ end
17
+
18
+ context "with other Ruby VMs" do
19
+ before do
20
+ if Coercible.rbx?
21
+ Coercible.stub!(:rbx? => false)
22
+ end
23
+ end
24
+
25
+ it { should == '%s' }
26
+ end
27
+ end
@@ -0,0 +1,21 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Integer, '#datetime_proc' do
4
+ subject { object.datetime_proc }
5
+
6
+ let(:object) { described_class.new }
7
+
8
+ context "with Rubinius" do
9
+ before do
10
+ unless Coercible.rbx?
11
+ Coercible.stub!(:rbx? => true)
12
+ end
13
+ end
14
+
15
+ it { should be_instance_of(Proc) }
16
+ end
17
+
18
+ context "with other Ruby VMs" do
19
+ it { should be_instance_of(Proc) }
20
+ end
21
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Integer, '#to_datetime' do
4
+ subject { object.to_datetime(value) }
5
+
6
+ let(:object) { described_class.new }
7
+ let(:value) { 1361036672 }
8
+
9
+ it { should be_instance_of(DateTime) }
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Object, '#coerced?' do
4
+ subject { object.coerced?(value) }
5
+
6
+ let(:object) { described_class.new }
7
+ let(:value) { 'something' }
8
+
9
+ it { should be(true) }
10
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Object, '#method_missing' do
4
+ subject { object.send(method_name, value) }
5
+
6
+ let(:object) { described_class.new }
7
+ let(:value) { Object.new }
8
+
9
+ context "when method matches coercion method regexp" do
10
+ let(:method_name) { :to_whatever }
11
+
12
+ it { should be(value) }
13
+ end
14
+
15
+ context "when method doesn't match coercion method regexp" do
16
+ let(:method_name) { :not_here }
17
+
18
+ specify { expect { subject }.to raise_error(NoMethodError) }
19
+ end
20
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::String, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { 'a string' }
8
+ let(:non_primitive_value) { :a_symbol }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Symbol, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { :symbol }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::Time, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { Time.now }
8
+ let(:non_primitive_value) { 'other' }
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ require 'spec_helper'
2
+
3
+ describe Coercer::TrueClass, '#coerced?' do
4
+ let(:object) { described_class.new }
5
+
6
+ it_behaves_like 'Coercible::Coercer#coerced?' do
7
+ let(:primitive_value) { true }
8
+ let(:non_primitive_value) { false }
9
+ end
10
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coercible
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-25 00:00:00.000000000 Z
12
+ date: 2013-02-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: backports
@@ -18,7 +18,7 @@ dependencies:
18
18
  requirements:
19
19
  - - ~>
20
20
  - !ruby/object:Gem::Version
21
- version: '2.6'
21
+ version: '2.8'
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
@@ -26,7 +26,7 @@ dependencies:
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: '2.6'
29
+ version: '2.8'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: descendants_tracker
32
32
  requirement: !ruby/object:Gem::Requirement
@@ -90,32 +90,45 @@ files:
90
90
  - lib/support/options.rb
91
91
  - lib/support/type_lookup.rb
92
92
  - spec/integration/configuring_coercers_spec.rb
93
+ - spec/shared/unit/coerced_predicate.rb
93
94
  - spec/shared/unit/configurable.rb
94
95
  - spec/spec_helper.rb
96
+ - spec/unit/coercible/coercer/array/coerced_predicate_spec.rb
95
97
  - spec/unit/coercible/coercer/array/to_set_spec.rb
96
98
  - spec/unit/coercible/coercer/class_methods/new_spec.rb
99
+ - spec/unit/coercible/coercer/date/coerced_predicate_spec.rb
97
100
  - spec/unit/coercible/coercer/date/to_date_spec.rb
98
101
  - spec/unit/coercible/coercer/date/to_datetime_spec.rb
99
102
  - spec/unit/coercible/coercer/date/to_string_spec.rb
100
103
  - spec/unit/coercible/coercer/date/to_time_spec.rb
104
+ - spec/unit/coercible/coercer/date_time/coerced_predicate_spec.rb
101
105
  - spec/unit/coercible/coercer/date_time/to_date_spec.rb
102
106
  - spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
103
107
  - spec/unit/coercible/coercer/date_time/to_string_spec.rb
104
108
  - spec/unit/coercible/coercer/date_time/to_time_spec.rb
109
+ - spec/unit/coercible/coercer/decimal/coerced_predicate_spec.rb
105
110
  - spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
106
111
  - spec/unit/coercible/coercer/decimal/to_float_spec.rb
107
112
  - spec/unit/coercible/coercer/decimal/to_integer_spec.rb
108
113
  - spec/unit/coercible/coercer/decimal/to_string_spec.rb
109
114
  - spec/unit/coercible/coercer/element_reference_spec.rb
115
+ - spec/unit/coercible/coercer/false_class/coerced_predicate_spec.rb
110
116
  - spec/unit/coercible/coercer/false_class/to_string_spec.rb
117
+ - spec/unit/coercible/coercer/float/coerced_predicate_spec.rb
118
+ - spec/unit/coercible/coercer/float/to_datetime_spec.rb
111
119
  - spec/unit/coercible/coercer/float/to_decimal_spec.rb
112
120
  - spec/unit/coercible/coercer/float/to_float_spec.rb
113
121
  - spec/unit/coercible/coercer/float/to_integer_spec.rb
114
122
  - spec/unit/coercible/coercer/float/to_string_spec.rb
123
+ - spec/unit/coercible/coercer/hash/coerced_predicate_spec.rb
115
124
  - spec/unit/coercible/coercer/hash/to_date_spec.rb
116
125
  - spec/unit/coercible/coercer/hash/to_datetime_spec.rb
117
126
  - spec/unit/coercible/coercer/hash/to_time_spec.rb
127
+ - spec/unit/coercible/coercer/integer/coerced_predicate_spec.rb
128
+ - spec/unit/coercible/coercer/integer/datetime_format_spec.rb
129
+ - spec/unit/coercible/coercer/integer/datetime_proc_spec.rb
118
130
  - spec/unit/coercible/coercer/integer/to_boolean_spec.rb
131
+ - spec/unit/coercible/coercer/integer/to_datetime_spec.rb
119
132
  - spec/unit/coercible/coercer/integer/to_decimal_spec.rb
120
133
  - spec/unit/coercible/coercer/integer/to_float_spec.rb
121
134
  - spec/unit/coercible/coercer/integer/to_integer_spec.rb
@@ -125,10 +138,13 @@ files:
125
138
  - spec/unit/coercible/coercer/numeric/to_float_spec.rb
126
139
  - spec/unit/coercible/coercer/numeric/to_integer_spec.rb
127
140
  - spec/unit/coercible/coercer/numeric/to_string_spec.rb
141
+ - spec/unit/coercible/coercer/object/coerced_predicate_spec.rb
142
+ - spec/unit/coercible/coercer/object/method_missing_spec.rb
128
143
  - spec/unit/coercible/coercer/object/to_array_spec.rb
129
144
  - spec/unit/coercible/coercer/object/to_hash_spec.rb
130
145
  - spec/unit/coercible/coercer/object/to_integer_spec.rb
131
146
  - spec/unit/coercible/coercer/object/to_string_spec.rb
147
+ - spec/unit/coercible/coercer/string/coerced_predicate_spec.rb
132
148
  - spec/unit/coercible/coercer/string/to_boolean_spec.rb
133
149
  - spec/unit/coercible/coercer/string/to_constant_spec.rb
134
150
  - spec/unit/coercible/coercer/string/to_date_spec.rb
@@ -139,13 +155,16 @@ files:
139
155
  - spec/unit/coercible/coercer/string/to_symbol_spec.rb
140
156
  - spec/unit/coercible/coercer/string/to_time_spec.rb
141
157
  - spec/unit/coercible/coercer/string_spec.rb
158
+ - spec/unit/coercible/coercer/symbol/coerced_predicate_spec.rb
142
159
  - spec/unit/coercible/coercer/symbol/to_string_spec.rb
160
+ - spec/unit/coercible/coercer/time/coerced_predicate_spec.rb
143
161
  - spec/unit/coercible/coercer/time/to_integer_spec.rb
144
162
  - spec/unit/coercible/coercer/time/to_time_spec.rb
145
163
  - spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
146
164
  - spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
147
165
  - spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
148
166
  - spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
167
+ - spec/unit/coercible/coercer/true_class/coerced_predicate_spec.rb
149
168
  - spec/unit/coercible/coercer/true_class/to_string_spec.rb
150
169
  - spec/unit/coercible/configuration/class_methods/build_spec.rb
151
170
  homepage: https://github.com/solnic/coercible
@@ -174,32 +193,45 @@ specification_version: 3
174
193
  summary: Powerful, flexible and configurable coercion library. And nothing more.
175
194
  test_files:
176
195
  - spec/integration/configuring_coercers_spec.rb
196
+ - spec/shared/unit/coerced_predicate.rb
177
197
  - spec/shared/unit/configurable.rb
178
198
  - spec/spec_helper.rb
199
+ - spec/unit/coercible/coercer/array/coerced_predicate_spec.rb
179
200
  - spec/unit/coercible/coercer/array/to_set_spec.rb
180
201
  - spec/unit/coercible/coercer/class_methods/new_spec.rb
202
+ - spec/unit/coercible/coercer/date/coerced_predicate_spec.rb
181
203
  - spec/unit/coercible/coercer/date/to_date_spec.rb
182
204
  - spec/unit/coercible/coercer/date/to_datetime_spec.rb
183
205
  - spec/unit/coercible/coercer/date/to_string_spec.rb
184
206
  - spec/unit/coercible/coercer/date/to_time_spec.rb
207
+ - spec/unit/coercible/coercer/date_time/coerced_predicate_spec.rb
185
208
  - spec/unit/coercible/coercer/date_time/to_date_spec.rb
186
209
  - spec/unit/coercible/coercer/date_time/to_datetime_spec.rb
187
210
  - spec/unit/coercible/coercer/date_time/to_string_spec.rb
188
211
  - spec/unit/coercible/coercer/date_time/to_time_spec.rb
212
+ - spec/unit/coercible/coercer/decimal/coerced_predicate_spec.rb
189
213
  - spec/unit/coercible/coercer/decimal/to_decimal_spec.rb
190
214
  - spec/unit/coercible/coercer/decimal/to_float_spec.rb
191
215
  - spec/unit/coercible/coercer/decimal/to_integer_spec.rb
192
216
  - spec/unit/coercible/coercer/decimal/to_string_spec.rb
193
217
  - spec/unit/coercible/coercer/element_reference_spec.rb
218
+ - spec/unit/coercible/coercer/false_class/coerced_predicate_spec.rb
194
219
  - spec/unit/coercible/coercer/false_class/to_string_spec.rb
220
+ - spec/unit/coercible/coercer/float/coerced_predicate_spec.rb
221
+ - spec/unit/coercible/coercer/float/to_datetime_spec.rb
195
222
  - spec/unit/coercible/coercer/float/to_decimal_spec.rb
196
223
  - spec/unit/coercible/coercer/float/to_float_spec.rb
197
224
  - spec/unit/coercible/coercer/float/to_integer_spec.rb
198
225
  - spec/unit/coercible/coercer/float/to_string_spec.rb
226
+ - spec/unit/coercible/coercer/hash/coerced_predicate_spec.rb
199
227
  - spec/unit/coercible/coercer/hash/to_date_spec.rb
200
228
  - spec/unit/coercible/coercer/hash/to_datetime_spec.rb
201
229
  - spec/unit/coercible/coercer/hash/to_time_spec.rb
230
+ - spec/unit/coercible/coercer/integer/coerced_predicate_spec.rb
231
+ - spec/unit/coercible/coercer/integer/datetime_format_spec.rb
232
+ - spec/unit/coercible/coercer/integer/datetime_proc_spec.rb
202
233
  - spec/unit/coercible/coercer/integer/to_boolean_spec.rb
234
+ - spec/unit/coercible/coercer/integer/to_datetime_spec.rb
203
235
  - spec/unit/coercible/coercer/integer/to_decimal_spec.rb
204
236
  - spec/unit/coercible/coercer/integer/to_float_spec.rb
205
237
  - spec/unit/coercible/coercer/integer/to_integer_spec.rb
@@ -209,10 +241,13 @@ test_files:
209
241
  - spec/unit/coercible/coercer/numeric/to_float_spec.rb
210
242
  - spec/unit/coercible/coercer/numeric/to_integer_spec.rb
211
243
  - spec/unit/coercible/coercer/numeric/to_string_spec.rb
244
+ - spec/unit/coercible/coercer/object/coerced_predicate_spec.rb
245
+ - spec/unit/coercible/coercer/object/method_missing_spec.rb
212
246
  - spec/unit/coercible/coercer/object/to_array_spec.rb
213
247
  - spec/unit/coercible/coercer/object/to_hash_spec.rb
214
248
  - spec/unit/coercible/coercer/object/to_integer_spec.rb
215
249
  - spec/unit/coercible/coercer/object/to_string_spec.rb
250
+ - spec/unit/coercible/coercer/string/coerced_predicate_spec.rb
216
251
  - spec/unit/coercible/coercer/string/to_boolean_spec.rb
217
252
  - spec/unit/coercible/coercer/string/to_constant_spec.rb
218
253
  - spec/unit/coercible/coercer/string/to_date_spec.rb
@@ -223,13 +258,16 @@ test_files:
223
258
  - spec/unit/coercible/coercer/string/to_symbol_spec.rb
224
259
  - spec/unit/coercible/coercer/string/to_time_spec.rb
225
260
  - spec/unit/coercible/coercer/string_spec.rb
261
+ - spec/unit/coercible/coercer/symbol/coerced_predicate_spec.rb
226
262
  - spec/unit/coercible/coercer/symbol/to_string_spec.rb
263
+ - spec/unit/coercible/coercer/time/coerced_predicate_spec.rb
227
264
  - spec/unit/coercible/coercer/time/to_integer_spec.rb
228
265
  - spec/unit/coercible/coercer/time/to_time_spec.rb
229
266
  - spec/unit/coercible/coercer/time_coercions/to_date_spec.rb
230
267
  - spec/unit/coercible/coercer/time_coercions/to_datetime_spec.rb
231
268
  - spec/unit/coercible/coercer/time_coercions/to_string_spec.rb
232
269
  - spec/unit/coercible/coercer/time_coercions/to_time_spec.rb
270
+ - spec/unit/coercible/coercer/true_class/coerced_predicate_spec.rb
233
271
  - spec/unit/coercible/coercer/true_class/to_string_spec.rb
234
272
  - spec/unit/coercible/configuration/class_methods/build_spec.rb
235
273
  has_rdoc: