Module: Dry::Monads::RSpec Private
- Defined in:
- lib/dry/monads/extensions/rspec.rb
This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.
Defined Under Namespace
Modules: Matchers
Constant Summary collapse
- Constructors =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
- CONSTANTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
%i[Success Failure Some None List].to_set
- NESTED_CONSTANTS =
This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.
CONSTANTS.to_set { |c| "::#{c}" }
Class Method Summary collapse
- .name_to_const(name) ⇒ Object private
- .resolve_constant_name(name) ⇒ Object private
- .rspec_example_context?(location) ⇒ Boolean private
Class Method Details
.name_to_const(name) ⇒ Object
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.
149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/dry/monads/extensions/rspec.rb', line 149 def name_to_const(name) case name in :Success ::Dry::Monads::Result::Success in :Failure ::Dry::Monads::Result::Failure in :Some ::Dry::Monads::Maybe::Some in :None ::Dry::Monads::Maybe::None in :List ::Dry::Monads::List end end |
.resolve_constant_name(name) ⇒ Object
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.
139 140 141 142 143 144 145 146 147 |
# File 'lib/dry/monads/extensions/rspec.rb', line 139 def resolve_constant_name(name) if CONSTANTS.include?(name) name elsif NESTED_CONSTANTS.any? { |c| name.to_s.end_with?(c) } name[/::(\w+)$/, 1].to_sym else nil end end |
.rspec_example_context?(location) ⇒ Boolean
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.
164 165 166 167 168 169 |
# File 'lib/dry/monads/extensions/rspec.rb', line 164 def rspec_example_context?(location) example_group_instance = ::RSpec.current_example&.example_group_instance return false unless example_group_instance spec_example_block?(location) || example_group_method?(example_group_instance, location) end |