Class: Jylis::DataType::TREG::Result
- Inherits:
-
Object
- Object
- Jylis::DataType::TREG::Result
- Defined in:
- lib/jylis-rb/data_types/treg.rb
Overview
The result of a TREG query.
Instance Attribute Summary collapse
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Class Method Summary collapse
-
.parse(query_result) ⇒ Jylis::DataType::TREG::Result
Construct a Result from a raw query result.
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
-
#initialize(value, timestamp) ⇒ Result
constructor
A new instance of Result.
-
#time ⇒ Time
The timestamp as a Time object.
-
#timestamp_iso8601 ⇒ String
The timestamp as an ISO8601 formatted string.
-
#to_a ⇒ Object
Reconstruct the raw result returned by the database.
Constructor Details
#initialize(value, timestamp) ⇒ Result
Returns a new instance of Result.
21 22 23 24 |
# File 'lib/jylis-rb/data_types/treg.rb', line 21 def initialize(value, ) @value = value @timestamp = end |
Instance Attribute Details
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
10 11 12 |
# File 'lib/jylis-rb/data_types/treg.rb', line 10 def @timestamp end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
9 10 11 |
# File 'lib/jylis-rb/data_types/treg.rb', line 9 def value @value end |
Class Method Details
.parse(query_result) ⇒ Jylis::DataType::TREG::Result
Construct a Result from a raw query result.
17 18 19 |
# File 'lib/jylis-rb/data_types/treg.rb', line 17 def self.parse(query_result) new(query_result[0], query_result[1]) end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
27 28 29 30 |
# File 'lib/jylis-rb/data_types/treg.rb', line 27 def ==(other) other.value == self.value && other. == self. end |
#time ⇒ Time
Returns the timestamp as a Time object.
38 39 40 |
# File 'lib/jylis-rb/data_types/treg.rb', line 38 def time Time.at() end |
#timestamp_iso8601 ⇒ String
Returns the timestamp as an ISO8601 formatted string.
43 44 45 |
# File 'lib/jylis-rb/data_types/treg.rb', line 43 def time.utc.iso8601 end |
#to_a ⇒ Object
Reconstruct the raw result returned by the database.
33 34 35 |
# File 'lib/jylis-rb/data_types/treg.rb', line 33 def to_a [value, ] end |