Class: Slosilo::JWT::JSONHash

Inherits:
Hash
  • Object
show all
Defined in:
lib/slosilo/jwt.rb

Overview

a hash with a possibly frozen JSON stringification

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.load(raw) ⇒ Object



95
96
97
98
99
# File 'lib/slosilo/jwt.rb', line 95

def self.load raw
  self[JSON.load raw.to_s].tap do |h|
    h.send :repr=, raw
  end
end

Instance Method Details

#freezeObject



90
91
92
93
# File 'lib/slosilo/jwt.rb', line 90

def freeze
  @repr = to_json.freeze
  super
end

#to_sObject



86
87
88
# File 'lib/slosilo/jwt.rb', line 86

def to_s
  @repr || to_json
end