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.
48 49 50 |
# File 'lib/calais/response.rb', line 48 def exact @exact end |
#length ⇒ Object
Returns the value of attribute length.
48 49 50 |
# File 'lib/calais/response.rb', line 48 def length @length end |
#offset ⇒ Object
Returns the value of attribute offset.
48 49 50 |
# File 'lib/calais/response.rb', line 48 def offset @offset end |
#prefix ⇒ Object
Returns the value of attribute prefix.
48 49 50 |
# File 'lib/calais/response.rb', line 48 def prefix @prefix end |
#suffix ⇒ Object
Returns the value of attribute suffix.
48 49 50 |
# File 'lib/calais/response.rb', line 48 def suffix @suffix end |
Class Method Details
.from_node(node) ⇒ Object
Makes a new Instance object from an appropriate Nokogiri::XML::Node.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/calais/response.rb', line 51 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 |