Class: Object

Inherits:
BasicObject
Defined in:
lib/sixarm_ruby_to_id/object.rb

Overview

Cast an object to an id.

Instance Method Summary collapse

Instance Method Details

#to_i_idObject

Cast me to an int id.

Object.new.to_i_ids
#=> 70186724200120

Call #object_id.to_i on the object; this is a decent default. Subclasses will override this, e.g. String, Array, Numeric, etc.



15
16
17
# File 'lib/sixarm_ruby_to_id/object.rb', line 15

def to_i_id
  object_id.to_i
end

#to_i_idsObject

Cast me to a list of int ids.

Object.new.to_i_ids
#=> [70186724200120]

Call #object_id.to_i on the object; this is a decent default. Subclasses will override this, e.g. String, Array, Numeric, etc.



27
28
29
# File 'lib/sixarm_ruby_to_id/object.rb', line 27

def to_i_ids
  [self.to_i_id]
end