Module: HTM::LongTermMemory::RobotOperations

Included in:
HTM::LongTermMemory
Defined in:
lib/htm/long_term_memory/robot_operations.rb

Overview

Robot registration and activity tracking

Handles robot lifecycle management including:

  • Registration (find or create)

  • Activity timestamp updates

Instance Method Summary collapse

Instance Method Details

#register_robot(robot_name) ⇒ Integer

Register a robot

Parameters:

  • robot_name (String)

    Robot name

Returns:

  • (Integer)

    Robot ID



17
18
19
20
21
# File 'lib/htm/long_term_memory/robot_operations.rb', line 17

def register_robot(robot_name)
  robot = HTM::Models::Robot.find_or_create(name: robot_name)
  robot.update(last_active: Time.now)
  robot.id
end

#update_robot_activity(robot_id) ⇒ void

This method returns an undefined value.

Update robot activity timestamp

Parameters:

  • robot_id (Integer)

    Robot identifier



28
29
30
31
# File 'lib/htm/long_term_memory/robot_operations.rb', line 28

def update_robot_activity(robot_id)
  robot = HTM::Models::Robot.first(id: robot_id)
  robot&.update(last_active: Time.now)
end