Module: Scaffolder::ToolIndex

Included in:
BinaryHelper, Scaffolder::Tool::Help
Defined in:
lib/scaffolder/tool_index.rb

Instance Method Summary collapse

Instance Method Details

#[](type) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/scaffolder/tool_index.rb', line 14

def [](type)
  if tool_exists?(type)
    get_tool(type)
  else
    Scaffolder::Tool::Help
  end
end

#get_tool(name) ⇒ Object



6
7
8
# File 'lib/scaffolder/tool_index.rb', line 6

def get_tool(name)
  tools[normalise(name)]
end

#tool_exists?(name) ⇒ Boolean

Returns:

  • (Boolean)


10
11
12
# File 'lib/scaffolder/tool_index.rb', line 10

def tool_exists?(name)
  ! get_tool(name).nil?
end