Module: TTY::Prompt::ConverterDSL

Included in:
Converters
Defined in:
lib/tty/prompt/converter_dsl.rb

Instance Method Summary collapse

Instance Method Details

#convert(name, input) ⇒ Object


16
17
18
# File 'lib/tty/prompt/converter_dsl.rb', line 16

def convert(name, input)
  converter_registry[name].call(input)
end

#converter(*names, &block) ⇒ Object


12
13
14
# File 'lib/tty/prompt/converter_dsl.rb', line 12

def converter(*names, &block)
  converter_registry.register(*names, &block)
end

#converter_registryObject


8
9
10
# File 'lib/tty/prompt/converter_dsl.rb', line 8

def converter_registry
  @__converter_registry ||= ConverterRegistry.new
end