Sha256: 98f01bc425410ab5775b415ab6ae0e62d487fd6cc3a953ff642db65721080ccd

Contents?: true

Size: 347 Bytes

Versions: 6

Compression:

Stored size: 347 Bytes

Contents

require 'all_your_base'

module BSON
  class ObjectID
    # Translate ObjectID instances to a more human-friendly format.
    # The reverse operation is String#to_oid.
    # Requires the all-your-base gem.
    def to_display
      number = to_s.reverse.to_i(16)
      ::AllYourBase::Are.convert_from_base_10 number, :radix => 62
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
junk_drawer-0.0.7 lib/core_extensions/object_id.rb
junk_drawer-0.0.6 lib/core_extensions/object_id.rb
junk_drawer-0.0.5 lib/core_extensions/object_id.rb
junk_drawer-0.0.4 lib/core_extensions/object_id.rb
junk_drawer-0.0.3 lib/core_extensions/object_id.rb
junk_drawer-0.0.2 lib/core_extensions/object_id.rb