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.
11 12 13 14 |
# File 'lib/savon/options.rb', line 11 def initialize( = {}) = {} assign end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(option, _) ⇒ Object (private)
39 40 41 |
# File 'lib/savon/options.rb', line 39 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.
16 17 18 |
# File 'lib/savon/options.rb', line 16 def option_type @option_type end |
Instance Method Details
#[](option) ⇒ Object
18 19 20 |
# File 'lib/savon/options.rb', line 18 def [](option) [option] end |
#[]=(option, value) ⇒ Object
22 23 24 25 |
# File 'lib/savon/options.rb', line 22 def []=(option, value) value = [value].flatten send(option, *value) end |
#include?(option) ⇒ Boolean
27 28 29 |
# File 'lib/savon/options.rb', line 27 def include?(option) .key? option end |