Toycol::Protocol.define(:ruby) do |message| using Module.new { refine String do def get Toycol::Protocol.request.path do |message| /['"](?.+)['"]/.match(message)[:path] end Toycol::Protocol.request.http_method { |_| "GET" } end end } instance_eval message end