Method: Soaspec::ExchangeExtractor#methods_for_element

Defined in:
lib/soaspec/exchange/exchange_extractor.rb

#methods_for_element(element) ⇒ Object

Parameters:

  • element (String)

    Element to define methods for



39
40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/soaspec/exchange/exchange_extractor.rb', line 39

def methods_for_element(element)
  element_name = element.to_s.split('__custom_path_').last
  define_singleton_method(element_name) do
    exchange_handler.__send__(element, response) # Forward the call onto handler to retrieve the element for the response
  end
  define_singleton_method("#{element_name}?") do
    begin
      __send__ element_name
      true
    rescue NoElementAtPath
      false
    end
  end
end