Class: Savon::Options
- Inherits:
-
Object
- Object
- Savon::Options
- Defined in:
- lib/savon/options.rb
Overview
Base class for GlobalOptions and LocalOptions. Stores options in a hash, dispatches setter calls by method name, raises UnknownOptionError for anything not defined on the subclass.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#option_type ⇒ Object
readonly
Returns the value of attribute option_type.
Instance Method Summary collapse
- #[](option) ⇒ Object
- #[]=(option, value) ⇒ Object
- #include?(option) ⇒ Boolean
-
#initialize(options = {}) ⇒ Options
constructor
A new instance of Options.
Constructor Details
#initialize(options = {}) ⇒ Options
Returns a new instance of Options.
12 13 14 15 |
# File 'lib/savon/options.rb', line 12 def initialize( = {}) = {} assign end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(option, _) ⇒ Object (private)
40 41 42 |
# File 'lib/savon/options.rb', line 40 def method_missing(option, _) raise UnknownOptionError, "Unknown #{option_type} option: #{option.inspect}" end |
Instance Attribute Details
#option_type ⇒ Object (readonly)
Returns the value of attribute option_type.
17 18 19 |
# File 'lib/savon/options.rb', line 17 def option_type @option_type end |
Instance Method Details
#[](option) ⇒ Object
19 20 21 |
# File 'lib/savon/options.rb', line 19 def [](option) [option] end |
#[]=(option, value) ⇒ Object
23 24 25 26 |
# File 'lib/savon/options.rb', line 23 def []=(option, value) value = [value].flatten send(option, *value) end |
#include?(option) ⇒ Boolean
28 29 30 |
# File 'lib/savon/options.rb', line 28 def include?(option) .key? option end |