Class: CarbonMU::EdgeConnection
- Inherits:
-
Object
- Object
- CarbonMU::EdgeConnection
- Includes:
- Celluloid::IO, Celluloid::Logger
- Defined in:
- lib/carbonmu/edge_router/edge_connection.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #after_initialize(arg) ⇒ Object
- #before_shutdown ⇒ Object
- #handle_input(input) ⇒ Object
-
#initialize(arg = nil) ⇒ EdgeConnection
constructor
A new instance of EdgeConnection.
- #run ⇒ Object
- #shutdown ⇒ Object
Constructor Details
#initialize(arg = nil) ⇒ EdgeConnection
Returns a new instance of EdgeConnection.
11 12 13 14 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 11 def initialize(arg = nil) @id = SecureRandom.uuid after_initialize(arg) end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 7 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 6 def name @name end |
Instance Method Details
#after_initialize(arg) ⇒ Object
16 17 18 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 16 def after_initialize(arg) nil # to be implemented by subclasses, if desired end |
#before_shutdown ⇒ Object
34 35 36 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 34 def before_shutdown nil # to be implemented by subclasses, if desired end |
#handle_input(input) ⇒ Object
20 21 22 23 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 20 def handle_input(input) input.chomp! Actor[:edge_router].async.send_command_to_server(input, id) end |
#run ⇒ Object
25 26 27 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 25 def run raise NotImplementedError end |
#shutdown ⇒ Object
29 30 31 32 |
# File 'lib/carbonmu/edge_router/edge_connection.rb', line 29 def shutdown before_shutdown Actor[:edge_router].async.remove_connection(Actor.current) end |