Method: Calais::Response::Instance.from_node
- Defined in:
- lib/calais/response.rb
.from_node(node) ⇒ Object
Makes a new Instance object from an appropriate Nokogiri::XML::Node.
56 57 58 59 60 61 62 63 64 65 |
# File 'lib/calais/response.rb', line 56 def self.from_node(node) instance = self.new instance.prefix = node.xpath("c:prefix[1]").first.content instance.exact = node.xpath("c:exact[1]").first.content instance.suffix = node.xpath("c:suffix[1]").first.content instance.offset = node.xpath("c:offset[1]").first.content.to_i instance.length = node.xpath("c:length[1]").first.content.to_i instance end |