Module: Tally::Calculators
- Included in:
- Tally
- Defined in:
- lib/tally/calculators.rb
Instance Method Summary collapse
- #calculators ⇒ Object
- #register_calculator(*class_name) ⇒ Object
- #unregister_calculator(*class_names) ⇒ Object
Instance Method Details
#calculators ⇒ Object
4 5 6 |
# File 'lib/tally/calculators.rb', line 4 def calculators @calculators ||= [] end |
#register_calculator(*class_name) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/tally/calculators.rb', line 8 def register_calculator(*class_name) @calculators ||= [] class_name.each do |class_name| unless @calculators.include?(class_name.to_s) @calculators.push(class_name.to_s) end end nil end |
#unregister_calculator(*class_names) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/tally/calculators.rb', line 20 def unregister_calculator(*class_names) @calculators ||= [] class_names = class_names.map(&:to_s) @calculators.delete_if { |n| class_names.include?(n) } end |