Class: JSON::JWK::Set
- Inherits:
-
Array
- Object
- Array
- JSON::JWK::Set
- Defined in:
- lib/json/jwk/set.rb
Defined Under Namespace
Classes: KidNotFound
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
- #content_type ⇒ Object
-
#initialize(*jwks) ⇒ Set
constructor
A new instance of Set.
Constructor Details
#initialize(*jwks) ⇒ Set
Returns a new instance of Set.
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/json/jwk/set.rb', line 6 def initialize(*jwks) jwks = if jwks.first.is_a?(Hash) && (keys = jwks.first.with_indifferent_access[:keys]) keys else jwks end jwks = Array(jwks).flatten.collect do |jwk| JWK.new jwk end replace jwks end |
Instance Method Details
#as_json(options = {}) ⇒ Object
22 23 24 25 |
# File 'lib/json/jwk/set.rb', line 22 def as_json( = {}) # NOTE: Array.new wrapper is requied to avoid CircularReferenceError {keys: Array.new(self)} end |
#content_type ⇒ Object
18 19 20 |
# File 'lib/json/jwk/set.rb', line 18 def content_type 'application/jwk-set+json' end |