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.
55 56 57 58 |
# File 'lib/saro/dat/dat.rb', line 55 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.
53 54 55 |
# File 'lib/saro/dat/dat.rb', line 53 def plain_bytes @plain_bytes end |
#secure_bytes ⇒ Object (readonly)
Returns the value of attribute secure_bytes.
53 54 55 |
# File 'lib/saro/dat/dat.rb', line 53 def secure_bytes @secure_bytes end |
Instance Method Details
#plain ⇒ Object
60 61 62 |
# File 'lib/saro/dat/dat.rb', line 60 def plain @plain_bytes.force_encoding('utf-8') end |
#secure ⇒ Object
64 65 66 |
# File 'lib/saro/dat/dat.rb', line 64 def secure @secure_bytes.force_encoding('utf-8') end |
#to_s ⇒ Object
68 69 70 |
# File 'lib/saro/dat/dat.rb', line 68 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
72 73 74 |
# File 'lib/saro/dat/dat.rb', line 72 def to_unsafe_string "#{plain} #{secure}" end |