Class: Options::SRCommonOptionParser
- Inherits:
-
BasicOptionParser
- Object
- BasicOptionParser
- Options::SRCommonOptionParser
- Defined in:
- lib/options/sr_common_option_parser.rb
Overview
Option parser of basic (see Options::BasicOptionParser) and common options for sender and receiver client
Common sender and receiver options
- log-msgs
-
format of message(s) log (none/body/dict, default: DEFAULT_LOG_MSGS, see Defaults)
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from BasicOptionParser
Instance Method Summary collapse
-
#initialize ⇒ SRCommonOptionParser
constructor
Initialization of basic and common sender and receiver options.
-
#parse(args) ⇒ Object
- Parsing of basic and common options for sender and receiver client ==== Parameters args
-
arguments to parse.
Constructor Details
#initialize ⇒ SRCommonOptionParser
Initialization of basic and common sender and receiver options
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/options/sr_common_option_parser.rb', line 29 def initialize() # Initialization of basic options super() # SR usage @opt_parser. = "Usage: <sr_program> [OPTIONS]" # SR specific options with default values # Format of message log option .log_msgs = Defaults::DEFAULT_LOG_MSGS # Hash message content .msg_content_hashed = Defaults::DEFAULT_MSG_CONTENT_HASHED # Auto settle off .auto_settle_off = Defaults::DEFAULT_AUTO_SETTLE_OFF # Format of message log @opt_parser.on( "--log-msgs FORMAT", %w(none body dict interop), "format of message(s) log (none/body/dict/interop, "+ "default: #{Defaults::DEFAULT_LOG_MSGS})" ) do |log_msgs| .log_msgs = log_msgs end # Message content hashed @opt_parser.on( "--msg-content-hashed [HASHED]", Options::BOOLEAN_STRINGS, "display SHA-1 hash of message content in logged messages (true/false) (default: #{Defaults::DEFAULT_MSG_CONTENT_HASHED})" ) do |msg_content_hashed| .msg_content_hashed = true .msg_content_hashed = \ StringUtils.str_to_bool(msg_content_hashed) if msg_content_hashed end # Auto settle off @opt_parser.on( "--auto-settle-off [OFF]", Options::BOOLEAN_STRINGS, "disable auto settle mode (default: #{Defaults::DEFAULT_AUTO_SETTLE_OFF})" ) do |auto_settle_off| .auto_settle_off = true .auto_settle_off = \ StringUtils.str_to_bool(auto_settle_off) if auto_settle_off end .duration = 0 @opt_parser.on( "--duration DURATION", Float, "message actions total duration (defines msg-rate together with count, default 0)" ) do |d| .duration = d end end |
Instance Method Details
#parse(args) ⇒ Object
Parsing of basic and common options for sender and receiver client
Parameters
- args
-
arguments to parse
88 89 90 |
# File 'lib/options/sr_common_option_parser.rb', line 88 def parse(args) @opt_parser.parse(args) end |