class Toys::Tool

Base class for defining tools

This base class provides an alternative to the {Toys::DSL::Tool#tool} directive for defining tools in the Toys DSL. Creating a subclass of `Toys::Tool` will create a tool whose name is the “kebab-case” of the class name. Subclasses can be created only in the context of a tool configuration DSL. Furthermore, a class-defined tool can be created only at the top level of a configuration file, or within another class-defined tool. It cannot be a subtool of a tool block.

### Example

class FooBar < Toys::Tool
  desc "This is a tool called foo-bar"

  def run
    puts "foo-bar called"
  end
end

Public Class Methods

inherited(tool_class) click to toggle source

@private

Calls superclass method
# File lib/toys/dsl/base.rb, line 79
def self.inherited(tool_class)
  DSL::Internal.configure_class(tool_class)
  super
  DSL::Internal.setup_class_dsl(tool_class)
end