module EntitySchema::InstanceMethods

methods that will be available for interact

with Entity instances

Public Class Methods

new(params = EMPTY_HASH) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 7
def initialize(params = EMPTY_HASH)
  update_attributes(params)
end

Public Instance Methods

[](name)
Alias for: get
[]=(name, value)
Alias for: set
field?(name) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 27
def field?(name)
  self.class.entity_schema.field?(name)
end
get(name) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 21
def get(name)
  self.class.entity_schema.public_get(self, name)
end
Also aliased as: []
given?(name) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 31
def given?(name)
  self.class.entity_schema.given?(self, name)
end
key?(name) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 35
def key?(name)
  self.class.entity_schema.weak_given?(self, name)
end
set(name, value) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 15
def set(name, value)
  self.class.entity_schema.public_set(self, name, value)
end
Also aliased as: []=
to_h() click to toggle source
# File lib/entity_schema/instance_methods.rb, line 39
def to_h
  self.class.entity_schema.serialize(self)
end
update_attributes(params) click to toggle source
# File lib/entity_schema/instance_methods.rb, line 11
def update_attributes(params)
  self.class.entity_schema.set_from_params(self, params)
end