Class: RLM::Tool
- Inherits:
-
Object
- Object
- RLM::Tool
- Defined in:
- lib/rlm/tool.rb
Constant Summary collapse
- CATEGORIES =
%i[read_only write_requires_approval write_allowed dangerous_disabled].freeze
Class Method Summary collapse
- .category(value = nil) ⇒ Object
- .description(text = nil) ⇒ Object
- .inherited(subclass) ⇒ Object
- .registry_name ⇒ Object
Instance Method Summary collapse
Class Method Details
.category(value = nil) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/rlm/tool.rb', line 14 def category(value = nil) return @category || :read_only if value.nil? raise ArgumentError, "Unknown category: #{value.inspect}" unless CATEGORIES.include?(value) @category = value end |
.description(text = nil) ⇒ Object
8 9 10 11 12 |
# File 'lib/rlm/tool.rb', line 8 def description(text = nil) return @description if text.nil? @description = text end |
.inherited(subclass) ⇒ Object
25 26 27 28 29 |
# File 'lib/rlm/tool.rb', line 25 def inherited(subclass) super subclass.instance_variable_set(:@description, nil) subclass.instance_variable_set(:@category, nil) end |
.registry_name ⇒ Object
21 22 23 |
# File 'lib/rlm/tool.rb', line 21 def registry_name @registry_name ||= name.to_s.split("::").last end |
Instance Method Details
#call(**kwargs) ⇒ Object
32 33 34 |
# File 'lib/rlm/tool.rb', line 32 def call(**kwargs) raise NotImplementedError, "#{self.class} must implement #call" end |