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.



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

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:



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

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.



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

def option_type
  @option_type
end

Instance Method Details

#[](option) ⇒ Object



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

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

#[]=(option, value) ⇒ Object



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

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

#include?(option) ⇒ Boolean

Returns:

  • (Boolean)


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

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