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.
123 124 125 126 |
# File 'lib/saro/dat/dat.rb', line 123 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.
121 122 123 |
# File 'lib/saro/dat/dat.rb', line 121 def plain_bytes @plain_bytes end |
#secure_bytes ⇒ Object (readonly)
Returns the value of attribute secure_bytes.
121 122 123 |
# File 'lib/saro/dat/dat.rb', line 121 def secure_bytes @secure_bytes end |
Instance Method Details
#plain ⇒ Object
128 129 130 |
# File 'lib/saro/dat/dat.rb', line 128 def plain @plain_bytes.force_encoding('utf-8') end |
#secure ⇒ Object
132 133 134 |
# File 'lib/saro/dat/dat.rb', line 132 def secure @secure_bytes.force_encoding('utf-8') end |
#to_s ⇒ Object
136 137 138 |
# File 'lib/saro/dat/dat.rb', line 136 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
140 141 142 |
# File 'lib/saro/dat/dat.rb', line 140 def to_unsafe_string "#{plain} #{secure}" end |