Sha256: 9429805686238ebd947a64f3e6c94c5870bed10f19b82a1f8292f988ba480c3b

Contents?: true

Size: 613 Bytes

Versions: 1

Compression:

Stored size: 613 Bytes

Contents

require "as_mongo/version"
require "mongo"

module AsMongo
  class Ttt
    def hi
      "hi"
    end
  end
end

module BSON
  class OrderedHash
    def to_s
      _id.to_s
    end

    def _id
      fetch("_id",nil)
    end

    def created_at
      localtime_or_original_data("created_at")
    end

    def updated_at
      localtime_or_original_data("updated_at")
    end

    def deleted_at
      localtime_or_original_data("deleted_at")
    end

    private
    def localtime_or_original_data(at)
      utc_time = fetch(at,nil)
      (utc_time.class == Time) ? utc_time.localtime : utc_time
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
as_mongo-0.0.1 lib/as_mongo.rb