Module: Abt::Helpers

Defined in:
lib/abt/helpers.rb

Class Method Summary collapse

Class Method Details

.command_to_const(string) ⇒ Object



12
13
14
15
# File 'lib/abt/helpers.rb', line 12

def command_to_const(string)
  inflector = Dry::Inflector.new
  inflector.camelize(inflector.underscore(string))
end

.const_to_command(string) ⇒ Object



6
7
8
9
10
# File 'lib/abt/helpers.rb', line 6

def const_to_command(string)
  string = string.to_s.dup
  string[0] = string[0].downcase
  string.gsub(/([A-Z])/, '-\1').downcase
end

.read_user_inputObject



17
18
19
# File 'lib/abt/helpers.rb', line 17

def read_user_input
  open(tty_path, &:gets).strip # rubocop:disable Security/Open
end