class Makitzo::World::NamedEntity

NamedEntity is a base class for categories of objects uniquely identified by name. Equality is defined based on name and class.

Attributes

name[R]

Public Class Methods

new(app, name, options = {}) click to toggle source
# File lib/makitzo/world/named_entity.rb, line 22
def initialize(app, name, options = {})
  @app, @name = app, name.to_s
  options.each do |k,v|
    send(:"#{k}=", v)
  end
end
setting_accessor(*syms) click to toggle source
# File lib/makitzo/world/named_entity.rb, line 8
    def self.setting_accessor(*syms)
      syms.each do |sym|
        class_eval <<-CODE
          def #{sym};         read(:#{sym});        end
          def #{sym}=(value); set(:#{sym}, value);  end
        CODE
      end
    end

Public Instance Methods

<=>(other) click to toggle source
# File lib/makitzo/world/named_entity.rb, line 29
def <=>(other);   name <=> other.name;                            end
eql?(other) click to toggle source
# File lib/makitzo/world/named_entity.rb, line 31
def eql?(other);  other.is_a?(self.class) && other.name == name;  end
hash() click to toggle source
# File lib/makitzo/world/named_entity.rb, line 30
def hash;         name.hash;                                      end
read!(key) click to toggle source
# File lib/makitzo/world/named_entity.rb, line 35
def read!(key)
  val = read(key)
  raise MissingPropertyError if val.nil?
  val
end
to_s() click to toggle source
# File lib/makitzo/world/named_entity.rb, line 33
def to_s; name; end