samples/cmdline_inlines.rb in getopt-declare-1.09.7 vs samples/cmdline_inlines.rb in getopt-declare-1.12

- old
+ new

@@ -1,24 +1,27 @@ - -require "Getopt/Declare" - -def encode(t) - return Getopt::Declare.new(t,['-BUILD']).code -end - -=begin -Just type in something, like: - -=for Getopt::Declare - - -a Append mode -=cut - -=end - -$/ = '=cut' -if t = $stdin.readline - t.sub!( /^=for\s+Getopt::Declare\s*\n(.*?)\n=cut/esm ) { - '(self,source) = []'+encode("#$1") } -end - -print t +#!/bin/env ruby + +require "Getopt/Declare" + +def encode(t) + return Getopt::Declare.new(t,['-BUILD']).code +end + +=begin +Just type in something, like: + +=for Getopt::Declare + + -a Append mode +=cut + +=end + +$/ = '=cut' +if t = $stdin.readline + x = t.sub( /^=for\s+Getopt::Declare\s*\n(.*?)\n/esm ) { + '(self,source) = []'+encode("#$1") + } + puts x +end + +