Class: Himari::TokenString::Format
- Inherits:
-
Struct
- Object
- Struct
- Himari::TokenString::Format
- Defined in:
- lib/himari/token_string.rb
Instance Attribute Summary collapse
-
#handle ⇒ Object
Returns the value of attribute handle.
-
#header ⇒ Object
Returns the value of attribute header.
-
#secret ⇒ Object
Returns the value of attribute secret.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#handle ⇒ Object
Returns the value of attribute handle
110 111 112 |
# File 'lib/himari/token_string.rb', line 110 def handle @handle end |
#header ⇒ Object
Returns the value of attribute header
110 111 112 |
# File 'lib/himari/token_string.rb', line 110 def header @header end |
#secret ⇒ Object
Returns the value of attribute secret
110 111 112 |
# File 'lib/himari/token_string.rb', line 110 def secret @secret end |
Class Method Details
.parse(header, str) ⇒ Object
111 112 113 114 115 116 117 |
# File 'lib/himari/token_string.rb', line 111 def self.parse(header, str) parts = str.split('.') raise InvalidFormat unless parts.size == 3 raise InvalidFormat unless parts[0] == header new(header: header, handle: parts[1], secret: parts[2]) end |
Instance Method Details
#to_s ⇒ Object
119 120 121 |
# File 'lib/himari/token_string.rb', line 119 def to_s "#{header}.#{handle}.#{secret}" end |