lib/kamerling/client.rb in kamerling-0.0.2 vs lib/kamerling/client.rb in kamerling-0.0.3
- old
+ new
@@ -1,14 +1,13 @@
-module Kamerling class Client < UUIDEntity
- attribute :addr, Addr
- attribute :busy, Boolean, default: false
+require_relative 'addr'
+require_relative 'uuid_entity'
- def self.from_h hash
- super.tap do |client|
- client.addr = Addr[hash[:host], hash[:port], hash[:prot]]
+module Kamerling
+ class Client < UUIDEntity
+ attrs addr: Addr, busy: Boolean, type: Symbol
+ defaults busy: false
+
+ def to_h
+ attributes.merge(type: type.to_s)
end
end
-
- def to_h
- super.reject { |key, _| key == :addr }.merge addr.to_h
- end
-end end
+end