Sha256: e30eb376681e8ecd335c7abb2aae6a59a64bad0a16282a939915ed7f0212eb51
Contents?: true
Size: 411 Bytes
Versions: 26
Compression:
Stored size: 411 Bytes
Contents
#!/usr/bin/env ruby def commandify(string) words = {} interpolation_buffer = [] string.scan(/\w+/).each do |word| word.downcase! interpolation_buffer.push(word) end interpolation = (interpolation_buffer * '_') words[string] = "%<#{interpolation}>s" words end STDIN.each_line do |line| line = line.chomp! hash = commandify(line) hash.each do |k, v| puts "#{k} #{v}" end end
Version data entries
26 entries across 26 versions & 1 rubygems