Sha256: b8b232717690e5a9f61a30d1511d0a2bdacf7572beb6785fcc0566458d18f0fb
Contents?: true
Size: 1.4 KB
Versions: 2
Compression:
Stored size: 1.4 KB
Contents
require 'time' module OGR module InternalHelpers def self.included(base) base.extend(ClassMethods) end # @private module ClassMethods # Makes the interface consistent with the access flags for GDAL. # # @param flag [String] 'w' for writing, 'r' for reading. 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 # 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 [Fixnum] 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 # 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] def _format_time_zone_for_ogr(time_zone) if time_zone =~ /(00:00|GMT)\z/ 100 elsif time_zone 1 else 0 end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
ffi-gdal-1.0.0.beta7 | lib/ogr/internal_helpers.rb |
ffi-gdal-1.0.0.beta6 | lib/ogr/internal_helpers.rb |