Sha256: 9ae5a1b354c3ba0626e6325e61edee02c023f8dad2ced0c1d647df8a06fac833
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 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 fail "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 fail "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 =~ /GMT/ 100 elsif time_zone 1 else 0 end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ffi-gdal-1.0.0.beta5 | lib/ogr/internal_helpers.rb |