Sha256: 6d56d03ae8e7d1fb3081cdb34ea788f1387f35b0c57c8889812f760c01271d8f
Contents?: true
Size: 609 Bytes
Versions: 20
Compression:
Stored size: 609 Bytes
Contents
module Spyke class RfcConverter def initialize(input) @input = input end def convert output = @input.dup output = wrap_required_variables_in_curly_braces(output) output = convert_parens_to_curly_braces(output) output = remove_colons(output) output end private def wrap_required_variables_in_curly_braces(text) text.gsub(/(:\w+(?!\)))\b/, '{\1}') end def convert_parens_to_curly_braces(text) text.gsub('(', '{').gsub(')', '}') end def remove_colons(text) text.gsub(':', '') end end end
Version data entries
20 entries across 20 versions & 1 rubygems