Class: RSpec::JsonMatchers::Expectation::Builder Private
- Inherits:
-
Object
- Object
- RSpec::JsonMatchers::Expectation::Builder
- Defined in:
- lib/rspec/json_matchers/expectation.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Represents a builder that returns a RSpec::JsonMatchers::Expectation object from an input object
Instance Method Summary collapse
-
#build ⇒ Expectation
private
Create and return a RSpec::JsonMatchers::Expectation object according to one of the following - the class of object - does the object respond to
#call- the ancestors of the object (when it’s a class). -
#initialize(object) ⇒ Builder
constructor
private
Creates a bullder with an object that might or might not be a RSpec::JsonMatchers::Expectation object.
Constructor Details
#initialize(object) ⇒ Builder
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Creates a bullder with an object that might or might not be a RSpec::JsonMatchers::Expectation object
69 70 71 |
# File 'lib/rspec/json_matchers/expectation.rb', line 69 def initialize(object) @object = object end |
Instance Method Details
#build ⇒ Expectation
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create and return a RSpec::JsonMatchers::Expectation object according to one of the following
- the class of object
- does the object respond to `#call`
- the ancestors of the object (when it's a class)
80 81 82 83 84 85 86 87 |
# File 'lib/rspec/json_matchers/expectation.rb', line 80 def build return object if object.is_a?(Expectation) return expectation_by_class unless expectation_by_class.nil? return expectation_for_call if object.respond_to?(:call) return expectation_by_ancestors if object.is_a?(Class) Expectations::Private::Eq[object] end |