module Authlete::Model::Hashable

Public Instance Methods

to_hash() click to toggle source
# File lib/authlete/model/hashable.rb, line 40
def to_hash
  Hash[ instance_variables.map { |var| to_key_value_pair(var) } ]
end

Private Instance Methods

to_hash_key(var) click to toggle source
# File lib/authlete/model/hashable.rb, line 24
def to_hash_key(var)
  var.to_s.delete("@").to_sym
end
to_hash_value(key, var) click to toggle source
# File lib/authlete/model/hashable.rb, line 28
def to_hash_value(key, var)
  instance_variable_get(var)
end
to_key_value_pair(var) click to toggle source
# File lib/authlete/model/hashable.rb, line 32
def to_key_value_pair(var)
  key   = to_hash_key(var)
  value = to_hash_value(key, var)
  [ key, value ]
end