Class: Unitylock::Server::Entity::UnityFile
- Inherits:
-
Struct
- Object
- Struct
- Unitylock::Server::Entity::UnityFile
- Defined in:
- lib/unitylock/server/entity/unityfile.rb
Instance Attribute Summary collapse
-
#file ⇒ Object
Returns the value of attribute file.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
-
#user ⇒ Object
Returns the value of attribute user.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#file ⇒ Object
Returns the value of attribute file
6 7 8 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 6 def file @file end |
#updated_at ⇒ Object
Returns the value of attribute updated_at
6 7 8 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 6 def updated_at @updated_at end |
#user ⇒ Object
Returns the value of attribute user
6 7 8 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 6 def user @user end |
Class Method Details
.create(hash) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 25 def create(hash) unityfile = UnityFile.new default_values = { updated_at: Time.now } default_values.merge(hash).each do |key,value| unityfile[key] = value end unityfile end |
.json_create(o) ⇒ Object
21 22 23 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 21 def json_create(o) new(*o['v']) end |
Instance Method Details
#to_hash ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 12 def to_hash { user: self.user, file: self.file, updated_at: self.updated_at.strftime("%Y-%m-%d %H:%M:%S") } end |
#update ⇒ Object
7 8 9 10 |
# File 'lib/unitylock/server/entity/unityfile.rb', line 7 def update self.updated_at = Time.now self end |