Class: Relix::Keyer::Compact
Instance Method Summary collapse
- #index(index, name) ⇒ Object
-
#initialize(klass, options) ⇒ Compact
constructor
A new instance of Compact.
- #values(pk, klass) ⇒ Object
Methods inherited from Standard
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, ) @prefix = if(abbrev = [: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 |