Class: Neh::Cli::Base
- Inherits:
-
Object
- Object
- Neh::Cli::Base
- Defined in:
- lib/neh/cli/base.rb
Overview
rubocop:disable Metrics/ClassLength
Direct Known Subclasses
Instance Attribute Summary collapse
-
#uuid ⇒ Object
readonly
Returns the value of attribute uuid.
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(*args, options:) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(*args, options:) ⇒ Base
Returns a new instance of Base.
16 17 18 19 20 21 22 |
# File 'lib/neh/cli/base.rb', line 16 def initialize(*args, options:) @message = args.join(' ') @options = @message_pool = {} @expected_sequence_number = 1 @uuid = SecureRandom.uuid end |
Instance Attribute Details
#uuid ⇒ Object (readonly)
Returns the value of attribute uuid.
14 15 16 |
# File 'lib/neh/cli/base.rb', line 14 def uuid @uuid end |
Instance Method Details
#execute ⇒ Object
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/neh/cli/base.rb', line 24 def execute Async::WebSocket::Client.connect(endpoint, headers: { 'Authorization' => "Bearer #{token}" }) do |connection| while ( = connection.read) = JSON.parse(, symbolize_names: true) on_receive(connection, ) end end end |