Class: RubyQC::Modifier

Inherits:
Struct
  • Object
show all
Defined in:
lib/rubyqc/modifier.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Struct

rubyqc

Constructor Details

#initialize(args, &block) ⇒ Modifier

Returns a new instance of Modifier.



6
7
8
9
# File 'lib/rubyqc/modifier.rb', line 6

def initialize args, &block
  super(args, [], RubyQC.default_times, RubyQC.default_parallel)
  run(&block)
end

Instance Attribute Details

#argsObject

Returns the value of attribute args

Returns:

  • (Object)

    the current value of args



5
6
7
# File 'lib/rubyqc/modifier.rb', line 5

def args
  @args
end

#casesObject

Returns the value of attribute cases

Returns:

  • (Object)

    the current value of cases



5
6
7
# File 'lib/rubyqc/modifier.rb', line 5

def cases
  @cases
end

#errorsObject

Returns the value of attribute errors

Returns:

  • (Object)

    the current value of errors



5
6
7
# File 'lib/rubyqc/modifier.rb', line 5

def errors
  @errors
end

#threadsObject

Returns the value of attribute threads

Returns:

  • (Object)

    the current value of threads



5
6
7
# File 'lib/rubyqc/modifier.rb', line 5

def threads
  @threads
end

Instance Method Details

#parallel(t, &block) ⇒ Object

Raises:

  • (ArgumentError)


18
19
20
21
22
23
# File 'lib/rubyqc/modifier.rb', line 18

def parallel t, &block
  raise ArgumentError.new(
    "Must have at least 1 thread, but got: #{t}") if t <= 0
  self.threads = t
  run(&block)
end

#times(t, &block) ⇒ Object

Raises:

  • (ArgumentError)


11
12
13
14
15
16
# File 'lib/rubyqc/modifier.rb', line 11

def times t, &block
  raise ArgumentError.new(
    "Must run at least once, but got: #{t}") if t <= 0
  self.cases = t
  run(&block)
end