ngtk
1/24/2016 - 2:19 AM

generate ruby.rack.status_code.snip

generate ruby.rack.status_code.snip

require 'rack'

File.open "ruby.rack.status_code.snip", "w" do |out|
  Rack::Utils::HTTP_STATUS_CODES.each do |code, message|
    symbol = message.downcase.gsub(/\s|-|'/, '_').to_sym
    out.write <<-EOL
snippet     #{symbol}
abbr        #{code} #{message}
options     word
  :#{symbol}
    EOL
  end
end