Module: Reviewer::Tool::Conversions

Included in:
Command
Defined in:
lib/reviewer/tool/conversions.rb

Overview

Conversion functions for coercing values to Tool instances

Class Method Summary collapse

Class Method Details

.Tool(value) ⇒ Tool

Coerces a value into a Tool instance

Parameters:

  • the value to convert

Returns:

  • the resulting Tool instance

Raises:

  • if the value is not a Tool



11
12
13
14
15
16
# File 'lib/reviewer/tool/conversions.rb', line 11

def Tool(value) # rubocop:disable Naming/MethodName
  case value
  in Tool then value
  else raise TypeError, "Cannot convert #{value.class} to Tool"
  end
end