Module: Cero::Entity

Defined in:
lib/cero/entity.rb

Defined Under Namespace

Modules: ClassMethods

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



6
7
8
9
# File 'lib/cero/entity.rb', line 6

def self.included(base)
  base.extend(ClassMethods)
  base.__send__(:attr_accessor, :id)
end

Instance Method Details

#==(other) ⇒ Object



11
12
13
# File 'lib/cero/entity.rb', line 11

def ==(other)
  self.class == other.class && self.id == other.id && !self.id.nil?
end

#initialize(attributes = {}) ⇒ Object



15
16
17
18
19
# File 'lib/cero/entity.rb', line 15

def initialize(attributes = {})
  attributes.each do |k, v|
    public_send("#{k}=", v)
  end
end