Class: SPV::Options
- Inherits:
-
Object
- Object
- SPV::Options
- Defined in:
- lib/site_prism_vcr/options.rb
Overview
Keeps options which are used to identify path to fixtures and options for a waiter which holds execution until expectation has been met.
Instance Attribute Summary collapse
-
#shortcut_paths ⇒ Object
Returns the value of attribute shortcut_paths.
-
#waiter ⇒ Object
Returns the value of attribute waiter.
-
#waiter_options ⇒ Hash
private
Returns options of a waiter in a hash format.
Instance Method Summary collapse
-
#add_shortcut_path(shortcut, path) ⇒ void
private
Defines shortcut path to fixtures.
-
#clone_options ⇒ SPV::Options
private
Returns a copy of itself.
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
-
#merge_waiter_options!(options) ⇒ void
private
Merges already defined waiter’s options with a given hash.
-
#shortcut_path(shortcut) ⇒ String
private
Returns a full path associated with a shortcut.
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
8 9 10 11 12 13 14 |
# File 'lib/site_prism_vcr/options.rb', line 8 def initialize( = {}) @shortcut_paths = {} .each do |key, val| public_send("#{key}=", val) end end |
Instance Attribute Details
#shortcut_paths ⇒ Object
Returns the value of attribute shortcut_paths.
6 7 8 |
# File 'lib/site_prism_vcr/options.rb', line 6 def shortcut_paths @shortcut_paths end |
#waiter ⇒ Object
Returns the value of attribute waiter.
6 7 8 |
# File 'lib/site_prism_vcr/options.rb', line 6 def waiter @waiter end |
#waiter_options ⇒ Hash
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.
Returns options of a waiter in a hash format. If no options are defined, returns an empty hash.
56 57 58 |
# File 'lib/site_prism_vcr/options.rb', line 56 def @waiter_options end |
Instance Method Details
#add_shortcut_path(shortcut, path) ⇒ void
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.
This method returns an undefined value.
Defines shortcut path to fixtures.
24 25 26 27 28 |
# File 'lib/site_prism_vcr/options.rb', line 24 def add_shortcut_path(shortcut, path) path << '/' unless path[-1, 1] == '/' self.shortcut_paths[shortcut] = path end |
#clone_options ⇒ SPV::Options
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.
Returns a copy of itself.
46 47 48 |
# File 'lib/site_prism_vcr/options.rb', line 46 def dup end |
#merge_waiter_options!(options) ⇒ void
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.
This method returns an undefined value.
Merges already defined waiter’s options with a given hash.
If waiter’s options are not defined yet, it will define waiter options with a given hash.
68 69 70 |
# File 'lib/site_prism_vcr/options.rb', line 68 def () self. = self..merge() end |
#shortcut_path(shortcut) ⇒ String
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.
Returns a full path associated with a shortcut.
37 38 39 |
# File 'lib/site_prism_vcr/options.rb', line 37 def shortcut_path(shortcut) self.shortcut_paths[shortcut] end |