Class: Bake::BakeRtextServiceOptions
- Defined in:
- lib/rtext-service/options/options.rb
Instance Attribute Summary collapse
-
#loglevel ⇒ Object
readonly
String.
-
#patterns ⇒ Object
readonly
Returns the value of attribute patterns.
-
#timeout ⇒ Object
readonly
Number.
Instance Method Summary collapse
-
#initialize(argv) ⇒ BakeRtextServiceOptions
constructor
A new instance of BakeRtextServiceOptions.
- #parse_options ⇒ Object
- #usage ⇒ Object
Methods inherited from Parser
#add_option, #get_block, #num_parameter?, #parse_internal, #valid?
Constructor Details
#initialize(argv) ⇒ BakeRtextServiceOptions
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/rtext-service/options/options.rb', line 10 def initialize(argv) super(argv) @loglevel = 'info' @patterns = [] @timeout = 3600 add_option(["" ], lambda { |x| @patterns.push(x) }) add_option(["-l", "--loglevel" ], lambda { |x| set_loglevel(x) }) add_option(["-t", "--timeout" ], lambda { |x| @timeout = x.to_i }) add_option(["-h", "--help" ], lambda { usage; ExitHelper.exit(0) }) add_option(["--version" ], lambda { Bake::Version.printBakeFormatVersion; ExitHelper.exit(0) }) end |
Instance Attribute Details
#loglevel ⇒ Object (readonly)
String
6 7 8 |
# File 'lib/rtext-service/options/options.rb', line 6 def loglevel @loglevel end |
#patterns ⇒ Object (readonly)
Returns the value of attribute patterns.
7 8 9 |
# File 'lib/rtext-service/options/options.rb', line 7 def patterns @patterns end |
#timeout ⇒ Object (readonly)
Number
8 9 10 |
# File 'lib/rtext-service/options/options.rb', line 8 def timeout @timeout end |
Instance Method Details
#parse_options ⇒ Object
33 34 35 36 |
# File 'lib/rtext-service/options/options.rb', line 33 def () parse_internal(true) @patterns = ['./**'] unless @patterns.any? end |
#usage ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/rtext-service/options/options.rb', line 24 def usage puts [ "Usage: #{__FILE__} [options] <dir patterns>", " -l, --loglevel [string], log level is one of [debug, info, warn, error, fatal].", " -t, --timeout [number], idle timeout in seconds after which the service will shutdown. Default is 3600.", " dir patterns, glob patterns." ].join("\n") end |