Module: Jejune::Options
- Included in:
- Main
- Defined in:
- lib/jejune/main.rb
Instance Attribute Summary collapse
-
#debug_socket ⇒ Object
Returns the value of attribute debug_socket.
-
#encoding ⇒ Object
the input encoding type; defaults to
nil
(currently, not used). -
#input ⇒ Object
the input stream used by the Main script; defaults to
$stdin
. -
#interactive ⇒ Object
a boolean flag indicating whether or not to run the Main script in interactive mode; defaults to
false
. -
#no_output ⇒ Object
Returns the value of attribute no_output.
-
#profile ⇒ Object
Returns the value of attribute profile.
-
#ruby_prof ⇒ Object
Returns the value of attribute ruby_prof.
Instance Method Summary collapse
- #initialize(options = {}) ⇒ Object
-
#parse_options(argv = ARGV) ⇒ Object
constructs an OptionParser and parses the argument list provided by
argv
.
Instance Attribute Details
#debug_socket ⇒ Object
Returns the value of attribute debug_socket.
41 42 43 |
# File 'lib/jejune/main.rb', line 41 def debug_socket @debug_socket end |
#encoding ⇒ Object
the input encoding type; defaults to nil
(currently, not used)
33 34 35 |
# File 'lib/jejune/main.rb', line 33 def encoding @encoding end |
#input ⇒ Object
the input stream used by the Main script; defaults to $stdin
35 36 37 |
# File 'lib/jejune/main.rb', line 35 def input @input end |
#interactive ⇒ Object
a boolean flag indicating whether or not to run the Main script in interactive mode; defaults to false
38 39 40 |
# File 'lib/jejune/main.rb', line 38 def interactive @interactive end |
#no_output ⇒ Object
Returns the value of attribute no_output.
39 40 41 |
# File 'lib/jejune/main.rb', line 39 def no_output @no_output end |
#profile ⇒ Object
Returns the value of attribute profile.
40 41 42 |
# File 'lib/jejune/main.rb', line 40 def profile @profile end |
#ruby_prof ⇒ Object
Returns the value of attribute ruby_prof.
42 43 44 |
# File 'lib/jejune/main.rb', line 42 def ruby_prof @ruby_prof end |
Instance Method Details
#initialize(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/jejune/main.rb', line 44 def initialize( = {} ) @no_output = .fetch( :no_output, false ) @profile = .fetch( :profile, false ) @debug_socket = .fetch( :debug_socket, false ) @ruby_prof = .fetch( :ruby_prof, false ) @encoding = .fetch( :encoding, nil ) @interactive = .fetch( :interactive, false ) @input = .fetch( :input, $stdin ) end |
#parse_options(argv = ARGV) ⇒ Object
constructs an OptionParser and parses the argument list provided by argv
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/jejune/main.rb', line 55 def ( argv = ARGV ) oparser = OptionParser.new do | o | o.separator 'Input Options:' o.on( '-i', '--input "text to process"', doc( <<-END ) ) { |val| @input = val } | a string to use as direct input to the recognizer END o.on( '-I', '--interactive', doc( <<-END ) ) { @interactive = true } | run an interactive session with the recognizer END end ( oparser ) return oparser.parse( argv ) end |