Module: Atatus::Spies Private
- Defined in:
- lib/atatus/spies.rb,
lib/atatus/spies/s3.rb,
lib/atatus/spies/sns.rb,
lib/atatus/spies/sqs.rb,
lib/atatus/spies/http.rb,
lib/atatus/spies/json.rb,
lib/atatus/spies/rake.rb,
lib/atatus/spies/tilt.rb,
lib/atatus/spies/mongo.rb,
lib/atatus/spies/redis.rb,
lib/atatus/spies/resque.rb,
lib/atatus/spies/sequel.rb,
lib/atatus/spies/faraday.rb,
lib/atatus/spies/sidekiq.rb,
lib/atatus/spies/sinatra.rb,
lib/atatus/spies/net_http.rb,
lib/atatus/spies/sneakers.rb,
lib/atatus/spies/dynamo_db.rb,
lib/atatus/spies/shoryuken.rb,
lib/atatus/spies/delayed_job.rb,
lib/atatus/spies/sucker_punch.rb,
lib/atatus/spies/elasticsearch.rb,
lib/atatus/spies/action_dispatch.rb,
lib/atatus/spies/azure_storage_table.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
Classes: ActionDispatchSpy, AzureStorageTableSpy, DelayedJobSpy, DynamoDBSpy, ElasticsearchSpy, FaradaySpy, HTTPSpy, JSONSpy, MongoSpy, NetHTTPSpy, RakeSpy, RedisSpy, Registration, ResqueSpy, S3Spy, SNSSpy, SQSSpy, SequelSpy, ShoryukenSpy, SidekiqSpy, SinatraSpy, SneakersSpy, SuckerPunchSpy, TiltSpy
Class Method Summary collapse
- .hook_into(name) ⇒ Object private
- .installed ⇒ Object private
- .register(*args) ⇒ Object private
- .register_require_hook(registration) ⇒ Object private
- .require_hooks ⇒ Object private
- .safe_defined?(const_name) ⇒ Boolean private
- .without_faraday ⇒ Object private
- .without_net_http ⇒ Object private
Class Method Details
.hook_into(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.
85 86 87 88 89 90 91 92 93 94 95 |
# File 'lib/atatus/spies.rb', line 85 def self.hook_into(name) return unless (registration = require_hooks[name]) return unless safe_defined?(registration.const_name) installed[registration.const_name] = registration registration.install registration.require_paths.each do |path| require_hooks.delete path end end |
.installed ⇒ 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.
44 45 46 |
# File 'lib/atatus/spies.rb', line 44 def self.installed @installed ||= {} end |
.register(*args) ⇒ 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.
48 49 50 51 52 53 54 55 56 57 |
# File 'lib/atatus/spies.rb', line 48 def self.register(*args) registration = Registration.new(*args) if safe_defined?(registration.const_name) registration.install installed[registration.const_name] = registration else register_require_hook registration end end |
.register_require_hook(registration) ⇒ 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.
79 80 81 82 83 |
# File 'lib/atatus/spies.rb', line 79 def self.register_require_hook(registration) registration.require_paths.each do |path| require_hooks[path] = registration end end |
.require_hooks ⇒ 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.
40 41 42 |
# File 'lib/atatus/spies.rb', line 40 def self.require_hooks @require_hooks ||= {} end |
.safe_defined?(const_name) ⇒ 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.
97 98 99 |
# File 'lib/atatus/spies.rb', line 97 def self.safe_defined?(const_name) Util::Inflector.safe_constantize(const_name) end |
.without_faraday ⇒ 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.
59 60 61 62 63 64 65 66 67 |
# File 'lib/atatus/spies.rb', line 59 def self.without_faraday return yield unless defined?(FaradaySpy) # rubocop:disable Style/ExplicitBlockArgument Atatus::Spies::FaradaySpy.disable_in do yield end # rubocop:enable Style/ExplicitBlockArgument end |
.without_net_http ⇒ 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.
69 70 71 72 73 74 75 76 77 |
# File 'lib/atatus/spies.rb', line 69 def self.without_net_http return yield unless defined?(NetHTTPSpy) # rubocop:disable Style/ExplicitBlockArgument Atatus::Spies::NetHTTPSpy.disable_in do yield end # rubocop:enable Style/ExplicitBlockArgument end |