Class: Em::Nordnet::Feed::DSL

Inherits:
Object
  • Object
show all
Defined in:
lib/em-nordnet/feed/dsl.rb

Direct Known Subclasses

Private, Public

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeDSL

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

#callbacksObject (readonly)

Returns the value of attribute callbacks.



5
6
7
# File 'lib/em-nordnet/feed/dsl.rb', line 5

def callbacks
  @callbacks
end

#sessionObject (readonly)

Returns the value of attribute session.



5
6
7
# File 'lib/em-nordnet/feed/dsl.rb', line 5

def session
  @session
end

#socketObject (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

#hostnameObject

Raises:

  • (NotImplementedError)


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

#portObject

Raises:

  • (NotImplementedError)


37
38
39
# File 'lib/em-nordnet/feed/dsl.rb', line 37

def port
  raise NotImplementedError
end

#typesObject

Raises:

  • (NotImplementedError)


29
30
31
# File 'lib/em-nordnet/feed/dsl.rb', line 29

def types
  raise NotImplementedError
end