Class: Parse::Bytes
- Inherits:
-
Object
show all
- Defined in:
- lib/parse/datatypes.rb
Overview
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(data) ⇒ Bytes
Returns a new instance of Bytes.
129
130
131
132
|
# File 'lib/parse/datatypes.rb', line 129
def initialize(data)
bytes = data["base64"]
@value = Base64.decode64(bytes)
end
|
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
149
150
151
152
153
154
155
|
# File 'lib/parse/datatypes.rb', line 149
def method_missing(method, *args, &block)
if value.respond_to?(method)
value.send(method, *args, &block)
else
super(method)
end
end
|
Instance Attribute Details
Returns the value of attribute value.
127
128
129
|
# File 'lib/parse/datatypes.rb', line 127
def value
@value
end
|
Instance Method Details
#<=>(other) ⇒ Object
145
146
147
|
# File 'lib/parse/datatypes.rb', line 145
def <=>(other)
value <=> other.value
end
|
#eql?(other) ⇒ Boolean
Also known as:
==
134
135
136
137
|
# File 'lib/parse/datatypes.rb', line 134
def eql?(other)
self.class.equal?(other.class) &&
value == other.value
end
|
141
142
143
|
# File 'lib/parse/datatypes.rb', line 141
def hash
value.hash
end
|
#respond_to?(method, include_private = false) ⇒ Boolean
157
158
159
|
# File 'lib/parse/datatypes.rb', line 157
def respond_to?(method, include_private = false)
super || value.respond_to?(method, include_private)
end
|
#to_h(*a) ⇒ Object
Also known as:
as_json
#to_json(*a) ⇒ Object
169
170
171
|
# File 'lib/parse/datatypes.rb', line 169
def to_json(*a)
to_h.to_json(*a)
end
|