module Reviewer::Conversions

Conversion functions for special types in Reviewer

Public Class Methods

Tool(value) click to toggle source
# File lib/reviewer/conversions.rb, line 6
def Tool(value) # rubocop:disable Naming/MethodName
  case value
  when Tool   then value
  when Symbol then Tool.new(value)
  when String then Tool.new(value.to_sym)
  else raise TypeError, "Cannot convert #{value} to Tool"
  end
end
Verbosity(value) click to toggle source
# File lib/reviewer/conversions.rb, line 16
def Verbosity(value) # rubocop:disable Naming/MethodName
  case value
  when Command::Verbosity then value
  when Symbol             then Command::Verbosity.new(value)
  when String             then Command::Verbosity.new(value.to_sym)
  when Integer            then Command::Verbosity.new(Command::Verbosity::LEVELS[value])
  else raise TypeError, "Cannot convert #{value} to Verbosity"
  end
end

Private Instance Methods

Tool(value) click to toggle source
# File lib/reviewer/conversions.rb, line 6
def Tool(value) # rubocop:disable Naming/MethodName
  case value
  when Tool   then value
  when Symbol then Tool.new(value)
  when String then Tool.new(value.to_sym)
  else raise TypeError, "Cannot convert #{value} to Tool"
  end
end
Verbosity(value) click to toggle source
# File lib/reviewer/conversions.rb, line 16
def Verbosity(value) # rubocop:disable Naming/MethodName
  case value
  when Command::Verbosity then value
  when Symbol             then Command::Verbosity.new(value)
  when String             then Command::Verbosity.new(value.to_sym)
  when Integer            then Command::Verbosity.new(Command::Verbosity::LEVELS[value])
  else raise TypeError, "Cannot convert #{value} to Verbosity"
  end
end