Class: Tolerances
- Inherits:
-
Object
- Object
- Tolerances
- Defined in:
- lib/tolerances.rb
Constant Summary collapse
- VERSION =
'1.0.0'
Instance Attribute Summary collapse
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
-
#tolerances ⇒ Object
readonly
Returns the value of attribute tolerances.
Instance Method Summary collapse
-
#initialize(contents) ⇒ Tolerances
constructor
A new instance of Tolerances.
- #result(values) ⇒ Object
- #values_at(samples) ⇒ Object
Constructor Details
#initialize(contents) ⇒ Tolerances
Returns a new instance of Tolerances.
9 10 11 12 13 14 15 16 17 |
# File 'lib/tolerances.rb', line 9 def initialize( contents ) @contents = contents @tolerances = [] @template = '' @tags = Hash.new{ |h,k| h[k]=[] } find_tolerances create_template end |
Instance Attribute Details
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
7 8 9 |
# File 'lib/tolerances.rb', line 7 def @tags end |
#tolerances ⇒ Object (readonly)
Returns the value of attribute tolerances.
7 8 9 |
# File 'lib/tolerances.rb', line 7 def tolerances @tolerances end |
Instance Method Details
#result(values) ⇒ Object
34 35 36 |
# File 'lib/tolerances.rb', line 34 def result( values ) @template % values end |
#values_at(samples) ⇒ Object
23 24 25 26 27 28 29 30 31 32 |
# File 'lib/tolerances.rb', line 23 def values_at( samples ) if samples.size != .size raise "samples (#{samples.size}) != tags (#{@tags.size})" end values = [] @tolerances.each_with_index do |tol,i| values << tol.value_at( samples[tol.sample_index] ) end values end |