Class: Laborantin::ParameterRange

Inherits:
Object
  • Object
show all
Includes:
Metaprog::Describable
Defined in:
lib/laborantin/core/parameter.rb

Overview

A ParameterRange instance is more or less a wrapper over an Array of allowed values.

Instance Attribute Summary collapse

Attributes included from Metaprog::Describable

#description

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ ParameterRange

initialize a new instance with the desired name



38
39
40
41
42
# File 'lib/laborantin/core/parameter.rb', line 38

def initialize(name)
  @name = name
  @values = []
  @description = ''
end

Instance Attribute Details

#nameObject

The name of the parameter (should be unique in a Scenario’s parameters) Usually a symbol.



35
36
37
# File 'lib/laborantin/core/parameter.rb', line 35

def name
  @name
end

Instance Method Details

#eachObject

Iterates on allowed values for this parameter.



52
53
54
55
56
# File 'lib/laborantin/core/parameter.rb', line 52

def each
  @values.each do |v| 
    yield v
  end
end

#values(*args) ⇒ Object

Sets the allowed values. Currently only supports Array like. It is planned to support Iterable, but deterministic ones only.



46
47
48
49
# File 'lib/laborantin/core/parameter.rb', line 46

def values(*args)
  @values = args.flatten unless args.empty?
  @values
end