Class: OntologyUnited::DSL::OntologyEntityBase

Inherits:
Object
  • Object
show all
Includes:
VariableStore::Helper
Defined in:
lib/ontology-united/dsl/ontology_entity_base.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from VariableStore::Helper

#as

Instance Attribute Details

#the_callsObject (readonly)

Returns the value of attribute the_calls.



6
7
8
# File 'lib/ontology-united/dsl/ontology_entity_base.rb', line 6

def the_calls
  @the_calls
end

Class Method Details

.delegate_equality_to(method: nil, variable: nil) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/ontology-united/dsl/ontology_entity_base.rb', line 8

def self.delegate_equality_to(method: nil, variable: nil)
  define_method :== do |obj|
    if method
      return false unless self.respond_to?(method.to_sym)
      return false unless obj.respond_to?(method.to_sym)
      self.send(method.to_sym) == obj.send(method.to_sym)
    elsif variable
      own = self.instance_variable_get(:"@#{variable}")
      other = obj.instance_variable_get(:"@#{variable}")
      own == other
    end
  end
  define_method :eql? do |obj|
    self == obj
  end
  define_method :hash do
    if method
      self.send(method).hash
    elsif variable
      self.instance_variable_get(:"@#{variable}")
    end
  end

end

Instance Method Details

#parentObject



33
34
35
# File 'lib/ontology-united/dsl/ontology_entity_base.rb', line 33

def parent
  OntologyDSL.current
end