Module: Opencellid
- Defined in:
- lib/opencellid/opencellid.rb,
lib/opencellid/bbox.rb,
lib/opencellid/cell.rb,
lib/opencellid/error.rb,
lib/opencellid/utils.rb,
lib/opencellid/measure.rb,
lib/opencellid/version.rb,
lib/opencellid/response.rb
Overview
The module for the opencellid-client gem
Defined Under Namespace
Classes: BBox, Cell, Error, Measure, Opencellid, Response
Constant Summary collapse
- VERSION =
This library current version
'0.1.2'
Class Method Summary collapse
-
.to_datetime_or_nil(string, format) ⇒ DateTime
A helper function that avoids invoking ‘strptime` on a string when it is null or empty.
-
.to_f_or_nil(string) ⇒ Float
A helper function that avoids invoking ‘to_f` on a string when it is null or empty.
-
.to_i_or_nil(string) ⇒ Integer
A helper function that avoids invoking ‘to_i` on a string when it is null or empty.
Class Method Details
.to_datetime_or_nil(string, format) ⇒ DateTime
A helper function that avoids invoking ‘strptime` on a string when it is null or empty
21 22 23 |
# File 'lib/opencellid/utils.rb', line 21 def self.to_datetime_or_nil(string, format) string and string.length > 0 ? DateTime.strptime(string, format) : nil end |
.to_f_or_nil(string) ⇒ Float
A helper function that avoids invoking ‘to_f` on a string when it is null or empty
13 14 15 |
# File 'lib/opencellid/utils.rb', line 13 def self.to_f_or_nil(string) string and string.length > 0 ? string.to_f : nil end |
.to_i_or_nil(string) ⇒ Integer
A helper function that avoids invoking ‘to_i` on a string when it is null or empty
6 7 8 |
# File 'lib/opencellid/utils.rb', line 6 def self.to_i_or_nil(string) string and string.length > 0 ? string.to_i : nil end |