Skip to content

Commit

Permalink
Remove broken additional built-in predicates
Browse files Browse the repository at this point in the history
  • Loading branch information
aldesantis committed Apr 2, 2017
1 parent dd06b91 commit 68bce1e
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 90 deletions.
27 changes: 0 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,33 +93,6 @@ module API
end
```

### Additional Predicates

Pragma::Contract provides some helpful predicates in addition to
[dry-validation's defaults](http://dry-rb.org/gems/dry-validation/basics/built-in-predicates/):

```ruby
module API
module V1
module Post
module Contract
class Base < Pragma::Contract::Base
validation do
# This step is required for loading the additional predicates.
configure do
predicates Pragma::Contract::Predicates
end

# :present? checks that a string is not made of whitespace only.
required(:title).value(:present?)
end
end
end
end
end
end
```

## Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/pragmarb/pragma-contract.
Expand Down
2 changes: 0 additions & 2 deletions lib/pragma/contract.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@
require 'reform'

require 'pragma/contract/version'
require 'pragma/contract/predicates'
require 'pragma/contract/types'
require 'pragma/contract/base'

module Pragma
Expand Down
6 changes: 3 additions & 3 deletions lib/pragma/contract/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ module Contract
#
# @author Alessandro Desantis
class Base < Reform::Form
feature Coercion
feature Dry
feature Reform::Form::Coercion
feature Reform::Form::Dry

property :current_user, virtual: true

Expand Down Expand Up @@ -45,7 +45,7 @@ def maybe_coercible(type)
private

def build_type(namespace, type)
Object.const_get "Pragma::Contract::Types::#{namespace}::#{type.to_s.capitalize}"
Object.const_get "Reform::Form::Coercion::Types::#{namespace}::#{type.to_s.capitalize}"
end
end
end
Expand Down
17 changes: 0 additions & 17 deletions lib/pragma/contract/predicates.rb

This file was deleted.

11 changes: 0 additions & 11 deletions lib/pragma/contract/types.rb

This file was deleted.

30 changes: 0 additions & 30 deletions spec/pragma/contract/predicates_spec.rb

This file was deleted.

0 comments on commit 68bce1e

Please sign in to comment.