Class: INatGet::Data::Helper::Field::Accuracy Private
- Inherits:
-
Range
- Object
- INatGet::Data::Helper::Field
- Range
- INatGet::Data::Helper::Field::Accuracy
- Defined in:
- lib/inat-get/data/helpers/defs/accuracy.rb
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Instance Attribute Summary
Attributes inherited from INatGet::Data::Helper::Field
Instance Method Summary collapse
-
#initialize(helper, key) ⇒ Accuracy
constructor
private
A new instance of Accuracy.
- #to_api(value) ⇒ Object private
- #to_sequel(value) ⇒ Object private
Methods inherited from Range
Methods inherited from INatGet::Data::Helper::Field
Constructor Details
#initialize(helper, key) ⇒ Accuracy
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Accuracy.
7 8 9 |
# File 'lib/inat-get/data/helpers/defs/accuracy.rb', line 7 def initialize helper, key super helper, key, Integer end |
Instance Method Details
#to_api(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/inat-get/data/helpers/defs/accuracy.rb', line 11 def to_api value result = {} if value.begin && value.begin > 0 result[:acc_above] = value.begin end if value.end if value.begin result[:acc_below] = value.end else result[:acc_below_or_unknown] = value.end end end result end |
#to_sequel(value) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
26 27 28 29 30 31 |
# File 'lib/inat-get/data/helpers/defs/accuracy.rb', line 26 def to_sequel value return {} if value.nil? || (value.begin.nil? && value.end.nil?) result = { accuracy: value } result = Sequel.|(result, { accuracy: nil }) if value.begin.nil? result end |