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
75 76 77 |
# File 'lib/himari/token_string.rb', line 75 def handle @handle end |
#header ⇒ Object
Returns the value of attribute header
75 76 77 |
# File 'lib/himari/token_string.rb', line 75 def header @header end |
#secret ⇒ Object
Returns the value of attribute secret
75 76 77 |
# File 'lib/himari/token_string.rb', line 75 def secret @secret end |
Class Method Details
.parse(header, str) ⇒ Object
76 77 78 79 80 81 |
# File 'lib/himari/token_string.rb', line 76 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
83 84 85 |
# File 'lib/himari/token_string.rb', line 83 def to_s "#{header}.#{handle}.#{secret}" end |