Class: Spec::Performance::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/spec/performance/configuration.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options) ⇒ Configuration

Returns a new instance of Configuration.



6
7
8
# File 'lib/spec/performance/configuration.rb', line 6

def initialize(options)
  @options = options
end

Instance Attribute Details

#optionsObject (readonly)

Returns the value of attribute options.



4
5
6
# File 'lib/spec/performance/configuration.rb', line 4

def options
  @options
end

Class Method Details

.configure {|instance| ... } ⇒ Object

Yields:



39
40
41
# File 'lib/spec/performance/configuration.rb', line 39

def configure(&block)
  yield(instance)
end

.configured_optionsObject



43
44
45
# File 'lib/spec/performance/configuration.rb', line 43

def configured_options
  instance.options
end

.default_optionsObject



47
48
49
50
51
52
53
54
55
56
# File 'lib/spec/performance/configuration.rb', line 47

def default_options
  {
      :concurrency => 1,
      :iterations => 20,
      :iterations_per_second => nil,
      :maximum_iteration_time => nil,
      :performance_driver_class => Spec::Client::HttpClient,
      :performance_driver_base_uri => "http://localhost/"
  }
end

.instanceObject



35
36
37
# File 'lib/spec/performance/configuration.rb', line 35

def instance
  @@instance ||= new(default_options)
end

Instance Method Details

#concurrency=(value) ⇒ Object



10
11
12
# File 'lib/spec/performance/configuration.rb', line 10

def concurrency=(value)
  @options[:concurrency] = value
end

#iterations=(value) ⇒ Object



14
15
16
# File 'lib/spec/performance/configuration.rb', line 14

def iterations=(value)
  @options[:iterations] = value
end

#iterations_per_second=(value) ⇒ Object



18
19
20
# File 'lib/spec/performance/configuration.rb', line 18

def iterations_per_second=(value)
  @options[:iterations_per_second] = value
end

#maximum_iteration_time=(value) ⇒ Object



22
23
24
# File 'lib/spec/performance/configuration.rb', line 22

def maximum_iteration_time=(value)
  @options[:maximum_iteration_time] = value
end

#performance_driver_base_uri=(value) ⇒ Object



30
31
32
# File 'lib/spec/performance/configuration.rb', line 30

def performance_driver_base_uri=(value)
  @options[:performance_driver_base_uri] = value
end

#performance_driver_class=(value) ⇒ Object



26
27
28
# File 'lib/spec/performance/configuration.rb', line 26

def performance_driver_class=(value)
  @options[:performance_driver_class] = value
end