Module: EPP::ResponseHelper
- Included in:
- Contact::Response, Domain::Response, Host::Response
- Defined in:
- lib/epp-client/response_helper.rb
Instance Method Summary collapse
- #nodes_for_xpath(xpath, base = nil) ⇒ Object
- #value_for_xpath(xpath, base = nil, &block) ⇒ Object
- #values_for_xpath(xpath, base = nil) ⇒ Object
Instance Method Details
#nodes_for_xpath(xpath, base = nil) ⇒ Object
20 21 22 23 |
# File 'lib/epp-client/response_helper.rb', line 20 def nodes_for_xpath(xpath, base = nil) base ||= @response.data base.find(xpath, namespaces) end |
#value_for_xpath(xpath, base = nil, &block) ⇒ Object
3 4 5 |
# File 'lib/epp-client/response_helper.rb', line 3 def value_for_xpath(xpath, base = nil, &block) values_for_xpath(xpath, base, &block).first end |
#values_for_xpath(xpath, base = nil) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/epp-client/response_helper.rb', line 6 def values_for_xpath(xpath, base = nil) nodes_for_xpath(xpath, base).map do |node| if block_given? yield node else case node when XML::Node node.content.strip when XML::Attr node.value end end end end |