Class: Hyperion::Types

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/types.rb

Class Method Summary collapse

Class Method Details

.foreign_key(kind) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
# File 'lib/hyperion/types.rb', line 8

def foreign_key(kind)
  kind_key = "#{Format.format_kind(kind)}_key".to_sym
  unless Hyperion.packer_defined?(kind_key)
    Hyperion.pack(kind_key) do |key|
      Hyperion.datastore.pack_key(kind, key)
    end
    Hyperion.unpack(kind_key) do |key|
      Hyperion.datastore.unpack_key(kind, key)
    end
  end
  kind_key
end