Class: Parse::File
- Inherits:
-
Object
- Object
- Parse::File
- Defined in:
- lib/parse/datatypes.rb
Overview
File
Instance Attribute Summary collapse
-
#name ⇒ Object
‘{“__type”:“File”, “name”:“profile.png”, “url”=>“”}’.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
- #as_json(*a) ⇒ Object
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(data) ⇒ File
constructor
A new instance of File.
- #to_json(*a) ⇒ Object
Constructor Details
#initialize(data) ⇒ File
Returns a new instance of File.
271 272 273 274 |
# File 'lib/parse/datatypes.rb', line 271 def initialize(data) @name = data["name"] @url = data["url"] end |
Instance Attribute Details
#name ⇒ Object
‘{“__type”:“File”, “name”:“profile.png”, “url”=>“”}’
268 269 270 |
# File 'lib/parse/datatypes.rb', line 268 def name @name end |
#url ⇒ Object
Returns the value of attribute url.
269 270 271 |
# File 'lib/parse/datatypes.rb', line 269 def url @url end |
Instance Method Details
#as_json(*a) ⇒ Object
287 288 289 290 291 292 293 |
# File 'lib/parse/datatypes.rb', line 287 def as_json(*a) { Protocol::KEY_TYPE => Protocol::TYPE_FILE, "name" => @name, "url" => @url } end |
#eql?(other) ⇒ Boolean Also known as: ==
276 277 278 279 |
# File 'lib/parse/datatypes.rb', line 276 def eql?(other) self.class.equal?(other.class) && url == other.url end |
#hash ⇒ Object
283 284 285 |
# File 'lib/parse/datatypes.rb', line 283 def hash url.hash end |
#to_json(*a) ⇒ Object
295 296 297 |
# File 'lib/parse/datatypes.rb', line 295 def to_json(*a) as_json.to_json(*a) end |