Class: Em::Nordnet::Feed::DSL
- Inherits:
-
Object
- Object
- Em::Nordnet::Feed::DSL
- Defined in:
- lib/em-nordnet/feed/dsl.rb
Instance Attribute Summary collapse
-
#callbacks ⇒ Object
readonly
Returns the value of attribute callbacks.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#socket ⇒ Object
readonly
Returns the value of attribute socket.
Instance Method Summary collapse
- #add_callback(type, block) ⇒ Object
- #hostname ⇒ Object
-
#initialize ⇒ DSL
constructor
A new instance of DSL.
- #on_heartbeat(&block) ⇒ Object
- #port ⇒ Object
- #types ⇒ Object
Constructor Details
#initialize ⇒ DSL
Returns a new instance of DSL.
7 8 9 10 11 |
# File 'lib/em-nordnet/feed/dsl.rb', line 7 def initialize @callbacks = initialize_callbacks socket.on_tick { |data| run_callback data } end |
Instance Attribute Details
#callbacks ⇒ Object (readonly)
Returns the value of attribute callbacks.
5 6 7 |
# File 'lib/em-nordnet/feed/dsl.rb', line 5 def callbacks @callbacks end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
5 6 7 |
# File 'lib/em-nordnet/feed/dsl.rb', line 5 def session @session end |
#socket ⇒ Object (readonly)
Returns the value of attribute socket.
5 6 7 |
# File 'lib/em-nordnet/feed/dsl.rb', line 5 def socket @socket end |
Instance Method Details
#add_callback(type, block) ⇒ Object
25 26 27 |
# File 'lib/em-nordnet/feed/dsl.rb', line 25 def add_callback type, block @callbacks[type] << block end |
#hostname ⇒ Object
33 34 35 |
# File 'lib/em-nordnet/feed/dsl.rb', line 33 def hostname raise NotImplementedError end |
#on_heartbeat(&block) ⇒ Object
21 22 23 |
# File 'lib/em-nordnet/feed/dsl.rb', line 21 def on_heartbeat &block add_callback :heartbeat, block end |
#port ⇒ Object
37 38 39 |
# File 'lib/em-nordnet/feed/dsl.rb', line 37 def port raise NotImplementedError end |
#types ⇒ Object
29 30 31 |
# File 'lib/em-nordnet/feed/dsl.rb', line 29 def types raise NotImplementedError end |