Class: Parse::Bytes
Overview
Support for the Bytes type in Parse
Constant Summary collapse
- ATTRIBUTES =
The default attributes in a Parse Bytes hash.
{ __type: :string, base64: :string }.freeze
Constants inherited from Model
Model::CLASS_INSTALLATION, Model::CLASS_PRODUCT, Model::CLASS_ROLE, Model::CLASS_SESSION, Model::CLASS_USER, Model::ID, Model::KEY_CLASS_NAME, Model::KEY_CREATED_AT, Model::KEY_OBJECT_ID, Model::KEY_UPDATED_AT, Model::OBJECT_ID, Model::TYPE_ACL, Model::TYPE_BYTES, Model::TYPE_DATE, Model::TYPE_FIELD, Model::TYPE_FILE, Model::TYPE_GEOPOINT, Model::TYPE_NUMBER, Model::TYPE_OBJECT, Model::TYPE_POINTER, Model::TYPE_RELATION
Instance Attribute Summary collapse
- #attributes ⇒ ATTRIBUTES
Supports for mass assignment of values and encoding to JSON.
- #base64 ⇒ String
The base64 string representing the content.
Class Method Summary collapse
Instance Method Summary collapse
- #==(u) ⇒ Object
Two Parse::Bytes objects are equal if they have the same base64 signature.
- #decoded ⇒ Object
Get the content as decoded base64 bytes.
- #encode(str) ⇒ Object
Base64 encode and set the instance contents.
- #initialize(bytes = "") ⇒ Bytes constructor
initialize with a base64 string or a Bytes object.
- #parse_class ⇒ TYPE_BYTES (also: #__type)
Methods inherited from Model
Methods included from Client::Connectable
Constructor Details
Instance Attribute Details
#attributes ⇒ ATTRIBUTES
Supports for mass assignment of values and encoding to JSON.
33 34 35 | # File 'lib/parse/model/bytes.rb', line 33 def attributes ATTRIBUTES end |
#base64 ⇒ String
Returns the base64 string representing the content.
16 17 18 | # File 'lib/parse/model/bytes.rb', line 16 def base64 @base64 end |
Class Method Details
.parse_class ⇒ TYPE_BYTES
18 | # File 'lib/parse/model/bytes.rb', line 18 def self.parse_class; TYPE_BYTES; end |
Instance Method Details
#==(u) ⇒ Object
Two Parse::Bytes objects are equal if they have the same base64 signature
57 58 59 60 | # File 'lib/parse/model/bytes.rb', line 57 def ==(u) return false unless u.is_a?(self.class) @base64 == u.base64 end |
#decoded ⇒ Object
Get the content as decoded base64 bytes
44 45 46 | # File 'lib/parse/model/bytes.rb', line 44 def decoded Base64.decode64(@base64 || "") end |
#encode(str) ⇒ Object
Base64 encode and set the instance contents
39 40 41 | # File 'lib/parse/model/bytes.rb', line 39 def encode(str) @base64 = Base64.encode64(str) end |
#parse_class ⇒ TYPE_BYTES Also known as: __type
20 | # File 'lib/parse/model/bytes.rb', line 20 def parse_class; self.class.parse_class; end |