Class: Picky::Wrappers::Bundle::Calculation
- Defined in:
- lib/picky/wrappers/bundle/calculation.rb
Overview
A calculation rewrites the symbol into a float.
Note: A calculation will try to find a float in the index,
not a sym.
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Wrapper
Instance Method Summary collapse
-
#calculate(float) ⇒ Object
API.
-
#ids(float_str) ⇒ Object
SYMBOLS.
-
#weight(float_str) ⇒ Object
SYMBOLS.
Methods inherited from Wrapper
Constructor Details
This class inherits a constructor from Picky::Wrappers::Bundle::Wrapper
Instance Method Details
#calculate(float) ⇒ Object
API.
By default, a calculation does not calculate anything.
19 20 21 |
# File 'lib/picky/wrappers/bundle/calculation.rb', line 19 def calculate float float end |
#ids(float_str) ⇒ Object
SYMBOLS. Use a block here?
THINK Move the calculation elsewhere?
27 28 29 |
# File 'lib/picky/wrappers/bundle/calculation.rb', line 27 def ids float_str @bundle.ids calculate(float_str.to_f).to_s end |
#weight(float_str) ⇒ Object
SYMBOLS.
THINK Move the calculation elsewhere?
35 36 37 |
# File 'lib/picky/wrappers/bundle/calculation.rb', line 35 def weight float_str @bundle.weight calculate(float_str.to_f).to_s end |