lib/kamerling/result.rb in kamerling-0.0.2 vs lib/kamerling/result.rb in kamerling-0.0.3
- old
+ new
@@ -1,13 +1,12 @@
-module Kamerling class Result < UUIDEntity
- attribute :addr, Addr
- attribute :client, Client
- attribute :data, String
- attribute :task, Task
+require_relative 'addr'
+require_relative 'client'
+require_relative 'task'
+require_relative 'uuid_entity'
- def to_h
- super
- .reject { |key, _| key == :addr }.merge(addr.to_h)
- .reject { |key, _| key == :client }.merge(client_uuid: client.uuid)
- .reject { |key, _| key == :task }.merge task_uuid: task.uuid
+module Kamerling
+ class Result < UUIDEntity
+ attrs addr: Addr, client: Client, data: String, received_at: Time,
+ task: Task
+ defaults received_at: -> (*) { Time.now }
end
-end end
+end