Sha256: 630027abd9aedc791b27c64b5e476efb2c2f56bdf661bfe0b264d8541f2c4dfb
Contents?: true
Size: 1.34 KB
Versions: 2
Compression:
Stored size: 1.34 KB
Contents
ARGV documentation: """ ARGV is a singleton instance of @Array@ and holds all (command-line) arguments passed to a Fancy programm before it starts executing. """ def ARGV for_option: option_name do: block { """ @option_name Name of command-line option. @block @Block@ to be called with value of command-line option @option_name, if given. @return @true, if @option_name was found in @ARGV and @block was called, @false otherwise. Calls a given Block if a command-line option is in @ARGV. """ if: (ARGV index: option_name) then: |idx| { if: (block arity > 0) then: { if: (ARGV[idx + 1]) then: |arg| { block call: [arg] ARGV remove_at: idx ARGV remove_at: idx } } else: { block call ARGV remove_at: idx } return true } return false } def ARGV for_options: option_names do: block { """ @option_names @Fancy::Enumerable@ of related command-line option names. @block @Block@ to be called with value of any command-line option in @option_names, if given. @return @true, if any of @option_names was found in @ARGV and @block was called, @false otherwise. Calls a given Block if any of the given command-line options are in @ARGV. """ option_names each: |option_name| { if: (ARGV for_option: option_name do: block) then: { return true } } return false }
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
fancy-0.10.0 | lib/argv.fy |
fancy-0.9.0 | lib/argv.fy |