Sha256: 1c50ac5369901de986c57c001e9f6ab00cba5ded9e275b0a36d19e2b0e064e58
Contents?: true
Size: 674 Bytes
Versions: 5
Compression:
Stored size: 674 Bytes
Contents
module Lazydoc # A special type of self-resolving Method that whose to_s returns arguments # formatted for the command line. # # a = Arguments.new # a.subject = "def method(a, b='default', *c, &d)" # a.to_s # => "A B='default' C..." # class Arguments < Method # Self-resolves and returns arguments formatted for the command line. def to_s resolve arguments.collect do |arg| case arg when /^&/ then nil when /^\*/ then "#{arg[1..-1].upcase }..." when /^(.*?)=(.*)$/ then "#{$1.upcase}=#{$2}" else arg.upcase end end.compact.join(' ') end end end
Version data entries
5 entries across 5 versions & 1 rubygems