Class: Itinerary::Tool

Inherits:
Object
  • Object
show all
Defined in:
lib/itinerary/tool.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(itinerary, args) ⇒ Tool

Returns a new instance of Tool.



17
18
19
20
# File 'lib/itinerary/tool.rb', line 17

def initialize(itinerary, args)
  @itinerary = itinerary
  parse(args) if respond_to?(:parse)
end

Class Method Details

.find_tool(cmd) ⇒ Object



13
14
15
# File 'lib/itinerary/tool.rb', line 13

def self.find_tool(cmd)
  tool_class = @@tools.find { |t| t.name == cmd }
end

.inherited(subclass) ⇒ Object



4
5
6
7
# File 'lib/itinerary/tool.rb', line 4

def self.inherited(subclass)
  @@tools ||= []
  @@tools << subclass
end

.toolsObject



9
10
11
# File 'lib/itinerary/tool.rb', line 9

def self.tools
  @@tools
end