Class: Relix::Keyer::Compact

Inherits:
Standard show all
Defined in:
lib/relix/keyer.rb

Instance Method Summary collapse

Methods inherited from Standard

#component

Constructor Details

#initialize(klass, options) ⇒ Compact

Returns a new instance of Compact.



69
70
71
72
73
74
75
# File 'lib/relix/keyer.rb', line 69

def initialize(klass, options)
  @prefix = if(abbrev = options[:abbrev])
    (abbrev.respond_to?(:call) ? abbrev.call(klass.name) : abbrev)
  else
    klass.name
  end
end

Instance Method Details

#index(index, name) ⇒ Object



81
82
83
# File 'lib/relix/keyer.rb', line 81

def index(index, name)
  "#{@prefix}:#{name}:#{index.class.compact_kind}"
end

#values(pk, klass) ⇒ Object



77
78
79
# File 'lib/relix/keyer.rb', line 77

def values(pk, klass)
  "#{@prefix}:v:#{pk}"
end