Sha256: 3c3fc72524ef335b644e589acb65a5227b37c0fbe9b9b4ac194176b80de1871a

Contents?: true

Size: 551 Bytes

Versions: 2

Compression:

Stored size: 551 Bytes

Contents

module Greenwich
  module Utilities
    def self.get_time_zone_field(name, columns)
      target_columns = ["#{name}_time_zone", "time_zone"]

      get_target_column(target_columns, columns)
    end

    def self.get_time_field(name, columns)
      target_columns = ["#{name}_at", "#{name}_datetime", "#{name}_time"]

      get_target_column(target_columns, columns)
    end

  private
    def self.get_target_column(target_columns, all_columns)
      target_columns.each {|col| return col if all_columns.include?(col) }

      nil
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
greenwich-0.0.3 lib/greenwich/utilities.rb
greenwich-0.0.2 lib/greenwich/utilities.rb