Class: Kamerling::UUIDEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/kamerling/uuid_entity.rb

Direct Known Subclasses

Client, Dispatch, Project, Registration, Result, Task

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.attrs(hash = {}) ⇒ Object



13
14
15
# File 'lib/kamerling/uuid_entity.rb', line 13

def self.attrs(hash = {})
  hash.each { |name, klass| attribute name, klass }
end

.defaults(hash = {}) ⇒ Object



17
18
19
20
21
# File 'lib/kamerling/uuid_entity.rb', line 17

def self.defaults(hash = {})
  hash.each do |name, default|
    warn_off { attribute name, attribute_set[name].type, default: default }
  end
end

Instance Method Details

#to_hObject



23
24
25
26
27
# File 'lib/kamerling/uuid_entity.rb', line 23

def to_h
  attributes.map do |key, value|
    value.is_a?(UUIDEntity) ? [key, value.to_h] : [key, value]
  end.to_h
end