Class: Cucumber::Wire::Configuration
- Inherits:
-
Object
- Object
- Cucumber::Wire::Configuration
- Defined in:
- lib/cucumber/wire/configuration.rb
Constant Summary collapse
- DEFAULT_TIMEOUTS =
{ 'connect' => 11, 'invoke' => 120, 'begin_scenario' => 120, 'end_scenario' => 120 }
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
-
#port ⇒ Object
readonly
Returns the value of attribute port.
-
#unix ⇒ Object
readonly
Returns the value of attribute unix.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(args) ⇒ Configuration
constructor
A new instance of Configuration.
- #timeout(message = nil) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(args) ⇒ Configuration
Returns a new instance of Configuration.
16 17 18 19 20 21 |
# File 'lib/cucumber/wire/configuration.rb', line 16 def initialize(args) @host = args['host'] @port = args['port'] @unix = args['unix'] unless RUBY_PLATFORM.match?(/mingw|mswin/) @timeouts = DEFAULT_TIMEOUTS.merge(args['timeout'] || {}) end |
Instance Attribute Details
#host ⇒ Object (readonly)
Returns the value of attribute host.
9 10 11 |
# File 'lib/cucumber/wire/configuration.rb', line 9 def host @host end |
#port ⇒ Object (readonly)
Returns the value of attribute port.
9 10 11 |
# File 'lib/cucumber/wire/configuration.rb', line 9 def port @port end |
#unix ⇒ Object (readonly)
Returns the value of attribute unix.
9 10 11 |
# File 'lib/cucumber/wire/configuration.rb', line 9 def unix @unix end |
Class Method Details
.from_file(wire_file) ⇒ Object
11 12 13 14 |
# File 'lib/cucumber/wire/configuration.rb', line 11 def self.from_file(wire_file) settings = YAML.load(ERB.new(File.read(wire_file)).result) new(settings) end |
Instance Method Details
#timeout(message = nil) ⇒ Object
23 24 25 |
# File 'lib/cucumber/wire/configuration.rb', line 23 def timeout( = nil) @timeouts[.to_s] || 3 end |
#to_s ⇒ Object
27 28 29 30 31 |
# File 'lib/cucumber/wire/configuration.rb', line 27 def to_s return @unix if @unix "#{@host}:#{@port}" end |