Class: Mindee::Parsing::Standard::DateField
- Inherits:
-
Field
- Object
- AbstractField
- Field
- Mindee::Parsing::Standard::DateField
- Defined in:
- lib/mindee/parsing/standard/date_field.rb
Overview
Represents a date.
Instance Attribute Summary collapse
-
#date_object ⇒ Date?
readonly
The date as a standard Ruby
Date
object. -
#is_computed ⇒ Boolean?
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
raw
contents.
Attributes inherited from Field
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.
27 28 29 30 31 32 33 34 |
# File 'lib/mindee/parsing/standard/date_field.rb', line 27 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.
14 15 16 |
# File 'lib/mindee/parsing/standard/date_field.rb', line 14 def date_object @date_object end |
#is_computed ⇒ Boolean? (readonly)
Whether the field was computed or retrieved directly from the document.
23 24 25 |
# File 'lib/mindee/parsing/standard/date_field.rb', line 23 def is_computed @is_computed end |
#raw ⇒ String? (readonly)
The textual representation of the date as found on the document.
20 21 22 |
# File 'lib/mindee/parsing/standard/date_field.rb', line 20 def raw @raw end |
#value ⇒ String? (readonly)
The ISO 8601 representation of the date, regardless of the raw
contents.
17 18 19 |
# File 'lib/mindee/parsing/standard/date_field.rb', line 17 def value @value end |