Class: SwarmSDK::Tools::Clock

Inherits:
Base
  • Object
show all
Defined in:
lib/swarm_sdk/tools/clock.rb

Overview

Clock tool provides current date and time information

Returns current temporal information in a consistent format. Agents use this when they need to know what day/time it is.

Instance Method Summary collapse

Methods inherited from Base

removable, removable?, #removable?

Instance Method Details

#executeObject



34
35
36
37
38
39
40
41
42
43
# File 'lib/swarm_sdk/tools/clock.rb', line 34

def execute
  now = Time.now

  "    Current date: \#{now.strftime(\"%Y-%m-%d\")}\n    Current time: \#{now.strftime(\"%H:%M:%S\")}\n    Day of week: \#{now.strftime(\"%A\")}\n    ISO 8601: \#{now.iso8601}\n  RESULT\nend\n".chomp

#nameObject

Override name to return simple "Clock"



30
31
32
# File 'lib/swarm_sdk/tools/clock.rb', line 30

def name
  "Clock"
end