Class: Mindee::V1::Parsing::Standard::DateField
- Inherits:
-
BaseField
- Object
- AbstractField
- BaseField
- Mindee::V1::Parsing::Standard::DateField
- Defined in:
- lib/mindee/v1/parsing/standard/date_field.rb
Overview
Represents a date.
Instance Attribute Summary collapse
-
#date_object ⇒ Date?
readonly
The date as a standard Ruby
Dateobject. -
#is_computed ⇒ bool?
readonly
Whether the field was computed or retrieved directly from the document.
-
#raw ⇒ String?
readonly
The textual representation of the date as found on the document.
-
#value ⇒ String?
readonly
The ISO 8601 representation of the date, regardless of the
rawcontents.
Attributes inherited from BaseField
Attributes inherited from AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ DateField
constructor
A new instance of DateField.
Methods inherited from AbstractField
array_confidence, array_sum, float_to_string, #to_s
Constructor Details
#initialize(prediction, page_id) ⇒ DateField
Returns a new instance of DateField.
28 29 30 31 32 33 34 35 |
# File 'lib/mindee/v1/parsing/standard/date_field.rb', line 28 def initialize(prediction, page_id) super @is_computed = prediction['is_computed'] return unless @value @date_object = Date.parse(@value) @raw = prediction['raw'] end |
Instance Attribute Details
#date_object ⇒ Date? (readonly)
The date as a standard Ruby Date object.
15 16 17 |
# File 'lib/mindee/v1/parsing/standard/date_field.rb', line 15 def date_object @date_object end |
#is_computed ⇒ bool? (readonly)
Whether the field was computed or retrieved directly from the document.
24 25 26 |
# File 'lib/mindee/v1/parsing/standard/date_field.rb', line 24 def is_computed @is_computed end |
#raw ⇒ String? (readonly)
The textual representation of the date as found on the document.
21 22 23 |
# File 'lib/mindee/v1/parsing/standard/date_field.rb', line 21 def raw @raw end |
#value ⇒ String? (readonly)
The ISO 8601 representation of the date, regardless of the raw contents.
18 19 20 |
# File 'lib/mindee/v1/parsing/standard/date_field.rb', line 18 def value @value end |