Class: Finexclub::Signal
- Inherits:
-
Object
- Object
- Finexclub::Signal
- Includes:
- Document
- Defined in:
- lib/finexclub/signal.rb
Direct Known Subclasses
Finexclub::Signals::Alpha, Finexclub::Signals::Octopus, Finexclub::Signals::Prognosis, Finexclub::Signals::Zeta
Instance Attribute Summary collapse
-
#core ⇒ Object
readonly
Returns the value of attribute core.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(core, meta = {}) ⇒ Signal
constructor
A new instance of Signal.
Methods included from Document
Constructor Details
#initialize(core, meta = {}) ⇒ Signal
Returns a new instance of Signal.
6 7 8 9 |
# File 'lib/finexclub/signal.rb', line 6 def initialize(core, = {}) @core = core () end |
Instance Attribute Details
#core ⇒ Object (readonly)
Returns the value of attribute core.
4 5 6 |
# File 'lib/finexclub/signal.rb', line 4 def core @core end |
Class Method Details
.build(core, signal_type, params) ⇒ Object
18 19 20 21 22 |
# File 'lib/finexclub/signal.rb', line 18 def build(core, signal_type, params) signal = handler_for(signal_type).new(core) signal.build(params) signal end |
.handler_for(signal_type) ⇒ Object
12 13 14 15 16 |
# File 'lib/finexclub/signal.rb', line 12 def handler_for(signal_type) #class_name = signal_type.to_s.gsub(/\/(.?)/) { "::#{$1.upcase}" }.gsub(/(?:^|_)(.)/) { $1.upcase } class_name = signal_type.to_s.gsub(/^(.)/) { $1.upcase } Finexclub::Signals.const_get(class_name) end |