Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rename predicate #respond_to into #responds_to #95

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docsite/source/predicates.html.md
Original file line number Diff line number Diff line change
Expand Up @@ -492,7 +492,7 @@ is_filled.call("").success? # => false
is_filled.call({}).success? # => false
```

### Attribute (`attr?`, `respond_to?`)
### Attribute (`attr?`, `responds_to?`)

> Returns true when the struct input responds to the given method. Similar to Ruby's `Object#respond_to?` method

Expand Down
2 changes: 1 addition & 1 deletion lib/dry/logic/predicates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ def uri_rfc3986?(input)
format?(URI::RFC3986_Parser::RFC3986_URI, input)
end

def respond_to?(method, input)
def responds_to?(method, input)
input.respond_to?(method)
end

Expand Down
4 changes: 2 additions & 2 deletions spec/integration/builder/predicate_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1115,9 +1115,9 @@
end
end

describe :respond_to? do
describe :responds_to? do
let(:expression) do
->(*) { respond_to?(:awesome?) }
->(*) { responds_to?(:awesome?) }
end

describe "success" do
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/predicates/respond_to_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
require "dry/logic/predicates"

RSpec.describe Dry::Logic::Predicates do
describe "#respond_to?" do
let(:predicate_name) { :respond_to? }
describe "#responds_to?" do
let(:predicate_name) { :responds_to? }

context "when value responds to method" do
let(:arguments_list) do
Expand Down