Class: Parse::Bytes
- Inherits:
-
Object
- Object
- Parse::Bytes
- Defined in:
- lib/parse/datatypes.rb
Overview
Bytes
Instance Attribute Summary collapse
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(data) ⇒ Bytes
constructor
A new instance of Bytes.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(data) ⇒ Bytes
Returns a new instance of Bytes.
61 62 63 64 |
# File 'lib/parse/datatypes.rb', line 61 def initialize(data) bytes = data["base64"] @value = Base64.decode64(bytes) end |
Instance Attribute Details
#value ⇒ Object
Returns the value of attribute value.
59 60 61 |
# File 'lib/parse/datatypes.rb', line 59 def value @value end |
Instance Method Details
#to_json(*a) ⇒ Object
66 67 68 69 70 71 |
# File 'lib/parse/datatypes.rb', line 66 def to_json(*a) { Protocol::KEY_TYPE => Protocol::TYPE_BYTES, "base64" => Base64.encode64(@value) }.to_json(*a) end |