Class: Calais::Response::Instance
- Inherits:
-
Object
- Object
- Calais::Response::Instance
- Defined in:
- lib/calais/response.rb
Instance Attribute Summary collapse
-
#exact ⇒ Object
Returns the value of attribute exact.
-
#length ⇒ Object
Returns the value of attribute length.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#suffix ⇒ Object
Returns the value of attribute suffix.
Class Method Summary collapse
-
.from_node(node) ⇒ Object
Makes a new Instance object from an appropriate Nokogiri::XML::Node.
Instance Attribute Details
#exact ⇒ Object
Returns the value of attribute exact.
53 54 55 |
# File 'lib/calais/response.rb', line 53 def exact @exact end |
#length ⇒ Object
Returns the value of attribute length.
53 54 55 |
# File 'lib/calais/response.rb', line 53 def length @length end |
#offset ⇒ Object
Returns the value of attribute offset.
53 54 55 |
# File 'lib/calais/response.rb', line 53 def offset @offset end |
#prefix ⇒ Object
Returns the value of attribute prefix.
53 54 55 |
# File 'lib/calais/response.rb', line 53 def prefix @prefix end |
#suffix ⇒ Object
Returns the value of attribute suffix.
53 54 55 |
# File 'lib/calais/response.rb', line 53 def suffix @suffix end |
Class Method Details
.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 |