module OGR::InternalHelpers::ClassMethods
@private
Public Instance Methods
_boolean_access_flag(flag)
click to toggle source
Makes the interface consistent with the access flags for GDAL
.
@param flag [String] ‘w’ for writing, ‘r’ for reading.
# File lib/ogr/internal_helpers.rb, line 16 def _boolean_access_flag(flag) case flag when "w" then true when "r" then false else raise "Invalid access_flag '#{flag}'. Use 'r' or 'w'." end end
_format_time_zone_for_ogr(time_zone)
click to toggle source
OGR’s time zone rules:
* 0 = unknown * 1 = local time * 100 = GMT
This converts Ruby’s DateTime time zone info into OGR’s integer.
@param time_zone [String]
# File lib/ogr/internal_helpers.rb, line 49 def _format_time_zone_for_ogr(time_zone) if /(00:00|GMT)\z/.match?(time_zone) 100 elsif time_zone 1 else 0 end end
_format_time_zone_for_ruby(time_zone)
click to toggle source
OGR’s time zone rules:
* 0 = unknown * 1 = local time * 100 = GMT
This converts the OGR
integer into something usable by Ruby’s DateTime.
@param time_zone [Integer]
# File lib/ogr/internal_helpers.rb, line 32 def _format_time_zone_for_ruby(time_zone) case time_zone when 0 then nil when 1 then (Time.now.getlocal.utc_offset / 3600).to_s when 100 then "+0" else raise "Unable to process time zone: #{time_zone}" end end