Class: Legion::Extensions::Agentic::Language::ConceptualBlending::Helpers::MentalSpace

Inherits:
Object
  • Object
show all
Defined in:
lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, domain:) ⇒ MentalSpace

Returns a new instance of MentalSpace.



12
13
14
15
16
17
18
19
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 12

def initialize(name:, domain:)
  @id         = ::SecureRandom.uuid
  @name       = name
  @domain     = domain
  @elements   = {}
  @relations  = []
  @created_at = Time.now.utc
end

Instance Attribute Details

#created_atObject (readonly)

Returns the value of attribute created_at.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def created_at
  @created_at
end

#domainObject (readonly)

Returns the value of attribute domain.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def domain
  @domain
end

#elementsObject (readonly)

Returns the value of attribute elements.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def elements
  @elements
end

#idObject (readonly)

Returns the value of attribute id.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def id
  @id
end

#nameObject (readonly)

Returns the value of attribute name.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def name
  @name
end

#relationsObject (readonly)

Returns the value of attribute relations.



10
11
12
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 10

def relations
  @relations
end

Instance Method Details

#add_element(name:, properties: {}) ⇒ Object



21
22
23
24
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 21

def add_element(name:, properties: {})
  @elements[name] = properties
  self
end

#add_relation(from:, to:, type:) ⇒ Object



26
27
28
29
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 26

def add_relation(from:, to:, type:)
  @relations << { from: from, to: to, type: type }
  self
end

#element_namesObject



31
32
33
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 31

def element_names
  @elements.keys
end

#to_hObject



35
36
37
38
39
40
41
42
43
44
# File 'lib/legion/extensions/agentic/language/conceptual_blending/helpers/mental_space.rb', line 35

def to_h
  {
    id:         @id,
    name:       @name,
    domain:     @domain,
    elements:   @elements,
    relations:  @relations,
    created_at: @created_at
  }
end