Class: Savon::Options

Inherits:
Object
  • Object
show all
Defined in:
lib/savon/options.rb

Direct Known Subclasses

GlobalOptions, LocalOptions

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Options

Returns a new instance of Options.



7
8
9
10
# File 'lib/savon/options.rb', line 7

def initialize(options = {})
  @options = {}
  assign options
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(option, _) ⇒ Object (private)

Raises:



35
36
37
# File 'lib/savon/options.rb', line 35

def method_missing(option, _)
  raise UnknownOptionError, "Unknown #{option_type} option: #{option.inspect}"
end

Instance Attribute Details

#option_typeObject (readonly)

Returns the value of attribute option_type.



12
13
14
# File 'lib/savon/options.rb', line 12

def option_type
  @option_type
end

Instance Method Details

#[](option) ⇒ Object



14
15
16
# File 'lib/savon/options.rb', line 14

def [](option)
  @options[option]
end

#[]=(option, value) ⇒ Object



18
19
20
21
# File 'lib/savon/options.rb', line 18

def []=(option, value)
  value = [value].flatten
  self.send(option, *value)
end

#include?(option) ⇒ Boolean

Returns:

  • (Boolean)


23
24
25
# File 'lib/savon/options.rb', line 23

def include?(option)
  @options.key? option
end