Class: RobotLab::Durable::Entry

Inherits:
Data
  • Object
show all
Defined in:
lib/robot_lab/durable/entry.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#categoryObject (readonly)

Returns the value of attribute category

Returns:

  • (Object)

    the current value of category



5
6
7
# File 'lib/robot_lab/durable/entry.rb', line 5

def category
  @category
end

#contentObject (readonly)

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



5
6
7
# File 'lib/robot_lab/durable/entry.rb', line 5

def content
  @content
end

#created_atObject (readonly)

Returns the value of attribute created_at

Returns:

  • (Object)

    the current value of created_at



5
6
7
# File 'lib/robot_lab/durable/entry.rb', line 5

def created_at
  @created_at
end

#node_idObject (readonly)

Returns the value of attribute node_id

Returns:

  • (Object)

    the current value of node_id



5
6
7
# File 'lib/robot_lab/durable/entry.rb', line 5

def node_id
  @node_id
end

#reasoningObject (readonly)

Returns the value of attribute reasoning

Returns:

  • (Object)

    the current value of reasoning



5
6
7
# File 'lib/robot_lab/durable/entry.rb', line 5

def reasoning
  @reasoning
end

Class Method Details

.from_node(node) ⇒ Object



6
7
8
9
10
11
12
13
14
15
# File 'lib/robot_lab/durable/entry.rb', line 6

def self.from_node(node)
  meta = node['metadata'] || {}
  new(
    node_id:    node['id'],
    content:    node['content'],
    reasoning:  meta['reasoning'],
    category:   (meta['category'] || 'fact').to_sym,
    created_at: node['created_at']
  )
end