Module: Impersonation

Defined in:
app/models/impersonation.rb

Class Method Summary collapse

Class Method Details

.hash_for(id) ⇒ Object

Returns a hash based on the given id.

Raises:

  • (ArgumentError)


6
7
8
9
# File 'app/models/impersonation.rb', line 6

def self.hash_for(id)
  raise(ArgumentError, "Must provide an id") unless id
  generate_hash(id)
end

.valid_hash?(id, hash) ⇒ Boolean

Returns true if the given hash is valid for the given id.

Returns:

  • (Boolean)


14
15
16
# File 'app/models/impersonation.rb', line 14

def self.valid_hash?(id, hash)
  hash == generate_hash(id)
end