Class: Regent::Tool
- Inherits:
-
Object
- Object
- Regent::Tool
- Defined in:
- lib/regent/tool.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #call(argument) ⇒ Object
- #execute(*arguments) ⇒ Object
-
#initialize(name:, description:) ⇒ Tool
constructor
A new instance of Tool.
- #to_s ⇒ Object
Constructor Details
#initialize(name:, description:) ⇒ Tool
Returns a new instance of Tool.
7 8 9 10 |
# File 'lib/regent/tool.rb', line 7 def initialize(name:, description:) @name = name @description = description end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
12 13 14 |
# File 'lib/regent/tool.rb', line 12 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
12 13 14 |
# File 'lib/regent/tool.rb', line 12 def name @name end |
Instance Method Details
#call(argument) ⇒ Object
14 15 16 |
# File 'lib/regent/tool.rb', line 14 def call(argument) raise NotImplementedError, "Tool #{name} has not implemented the execute method" end |
#execute(*arguments) ⇒ Object
18 19 20 21 22 |
# File 'lib/regent/tool.rb', line 18 def execute(*arguments) call(*arguments) rescue NotImplementedError, StandardError => e raise ToolError, e. end |
#to_s ⇒ Object
24 25 26 |
# File 'lib/regent/tool.rb', line 24 def to_s "#{name} - #{description}" end |