Class: Radio::Utils::FirPM
- Inherits:
-
Object
- Object
- Radio::Utils::FirPM
- Defined in:
- lib/radio/utils/firpm.rb
Overview
Instances of FirPM will act as the result array. The result is lazily generated just-in-time for the first use. This allows for CONSTANT=FirPM.new assignments without the huge penalty to application startup. It also let’s us normalize the options at initialization for use as a cache key. It is strongly recommended to use the caching mixin.
Instance Attribute Summary collapse
-
#options ⇒ Object
readonly
Returns the value of attribute options.
Instance Method Summary collapse
-
#initialize(options) ⇒ FirPM
constructor
:type may be in [:bandpass, :differentiator, :hilbert] :maxiterations won’t raise error when negative.
- #method_missing(name, *opts, &block) ⇒ Object
Constructor Details
#initialize(options) ⇒ FirPM
:type may be in [:bandpass, :differentiator, :hilbert] :maxiterations won’t raise error when negative
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/radio/utils/firpm.rb', line 66 def initialize # normalized and frozen to be suitable for a hash key @options = { type: [:type].to_sym, numtaps: [:numtaps].to_i, bands: [:bands].flatten.collect(&:to_f).freeze, desired: [:desired].collect(&:to_f).freeze, weights: [:weights].collect(&:to_f).freeze, griddensity: [:griddensity] || 16, maxiterations: [:maxiterations] || 40 }.freeze end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *opts, &block) ⇒ Object
80 81 82 83 |
# File 'lib/radio/utils/firpm.rb', line 80 def method_missing name, *opts, &block firpm unless @h @h.send name, *opts, &block end |
Instance Attribute Details
#options ⇒ Object (readonly)
Returns the value of attribute options.
78 79 80 |
# File 'lib/radio/utils/firpm.rb', line 78 def @options end |