diff --git a/docsite/source/predicates.html.md b/docsite/source/predicates.html.md index 2d0cb46..bb5d0da 100644 --- a/docsite/source/predicates.html.md +++ b/docsite/source/predicates.html.md @@ -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 diff --git a/lib/dry/logic/predicates.rb b/lib/dry/logic/predicates.rb index 5147ef2..a099f7a 100644 --- a/lib/dry/logic/predicates.rb +++ b/lib/dry/logic/predicates.rb @@ -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 diff --git a/spec/integration/builder/predicate_spec.rb b/spec/integration/builder/predicate_spec.rb index a6f8435..3f86558 100644 --- a/spec/integration/builder/predicate_spec.rb +++ b/spec/integration/builder/predicate_spec.rb @@ -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 diff --git a/spec/unit/predicates/respond_to_spec.rb b/spec/unit/predicates/respond_to_spec.rb index df89ede..ab1b541 100644 --- a/spec/unit/predicates/respond_to_spec.rb +++ b/spec/unit/predicates/respond_to_spec.rb @@ -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