Class: ActsAsCaesar::Key

Inherits:
Object
  • Object
show all
Defined in:
lib/acts_as_caesar/objects/key.rb

Class Method Summary collapse

Class Method Details

.for_source(source) ⇒ Object



4
5
6
7
8
9
10
11
12
# File 'lib/acts_as_caesar/objects/key.rb', line 4

def for_source(source)
  if source.respond_to?(:acts_as_caesar_key)
    source.acts_as_caesar_key
  elsif source.respond_to?(:id)
    "#{source.class.name.gsub('::', '_').downcase}_#{source.id}"
  else
    source.to_s
  end
end