Class: Roma::Test::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/roma/tools/test-scenario.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(argv) ⇒ Config

Returns a new instance of Config.



273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# File 'lib/roma/tools/test-scenario.rb', line 273

def initialize(argv)
  opts = OptionParser.new
  opts.banner="usage:#{File.basename($0)} [options]"
  
  opts.on_tail("-h", "--help", "show this message") {
    puts opts; exit
  }
  @number_of_nodes = 3
  opts.on("-n N", "number of nodes[default: 3]", Integer) { |v|
    @number_of_nodes = v
  }

  @working_path = '.'
  opts.on("-p PATH", "working path[default: .]", String) { |v|
    @working_path = v
  }

  @hostname = 'localhost'
  opts.on("--hname HOSTNAME", "hostname[default: localhost]", String) { |v|
    @hostname = v
  }

  @port = 11211
  opts.on("--port PORT_NUMBER", "port number[default: 11211]", Integer) { |v|
    @port = v
  }

  opts.parse!(argv)
rescue OptionParser::ParseError => e
  $stderr.puts e.message
  $stderr.puts opts.help
  exit 1
end

Instance Attribute Details

#hostnameObject (readonly)

Returns the value of attribute hostname.



270
271
272
# File 'lib/roma/tools/test-scenario.rb', line 270

def hostname
  @hostname
end

#number_of_nodesObject (readonly)

Returns the value of attribute number_of_nodes.



268
269
270
# File 'lib/roma/tools/test-scenario.rb', line 268

def number_of_nodes
  @number_of_nodes
end

#portObject (readonly)

Returns the value of attribute port.



269
270
271
# File 'lib/roma/tools/test-scenario.rb', line 269

def port
  @port
end

#working_pathObject (readonly)

Returns the value of attribute working_path.



271
272
273
# File 'lib/roma/tools/test-scenario.rb', line 271

def working_path
  @working_path
end