Class: Saro::Dat::DatPayload
- Inherits:
-
Object
- Object
- Saro::Dat::DatPayload
- Defined in:
- lib/saro/dat/dat.rb
Instance Attribute Summary collapse
-
#plain_bytes ⇒ Object
readonly
Returns the value of attribute plain_bytes.
-
#secure_bytes ⇒ Object
readonly
Returns the value of attribute secure_bytes.
Instance Method Summary collapse
-
#initialize(plain, secure) ⇒ DatPayload
constructor
A new instance of DatPayload.
- #plain ⇒ Object
- #secure ⇒ Object
- #to_s ⇒ Object
- #to_unsafe_string ⇒ Object
Constructor Details
#initialize(plain, secure) ⇒ DatPayload
Returns a new instance of DatPayload.
109 110 111 112 |
# File 'lib/saro/dat/dat.rb', line 109 def initialize(plain, secure) @plain_bytes = plain @secure_bytes = secure end |
Instance Attribute Details
#plain_bytes ⇒ Object (readonly)
Returns the value of attribute plain_bytes.
107 108 109 |
# File 'lib/saro/dat/dat.rb', line 107 def plain_bytes @plain_bytes end |
#secure_bytes ⇒ Object (readonly)
Returns the value of attribute secure_bytes.
107 108 109 |
# File 'lib/saro/dat/dat.rb', line 107 def secure_bytes @secure_bytes end |
Instance Method Details
#plain ⇒ Object
114 115 116 |
# File 'lib/saro/dat/dat.rb', line 114 def plain @plain_bytes.force_encoding('utf-8') end |
#secure ⇒ Object
118 119 120 |
# File 'lib/saro/dat/dat.rb', line 118 def secure @secure_bytes.force_encoding('utf-8') end |
#to_s ⇒ Object
122 123 124 |
# File 'lib/saro/dat/dat.rb', line 122 def to_s "#{Saro::Dat::Util.encode_base64_url_str(@plain_bytes)} #{Saro::Dat::Util.encode_base64_url_str(@secure_bytes)}" end |
#to_unsafe_string ⇒ Object
126 127 128 |
# File 'lib/saro/dat/dat.rb', line 126 def to_unsafe_string "#{plain} #{secure}" end |