Class: NotepadqqApi
- Inherits:
-
Object
- Object
- NotepadqqApi
- Defined in:
- lib/notepadqq_api.rb,
lib/notepadqq_api/stubs.rb,
lib/notepadqq_api/message_channel.rb,
lib/notepadqq_api/message_interpreter.rb
Defined Under Namespace
Modules: Stubs Classes: MessageChannel, MessageInterpreter
Constant Summary collapse
- NQQ_STUB_ID =
1
Instance Attribute Summary collapse
-
#extensionId ⇒ Object
readonly
Returns the value of attribute extensionId.
Instance Method Summary collapse
-
#initialize(socketPath = ARGV[0], extensionId = ARGV[1]) ⇒ NotepadqqApi
constructor
A new instance of NotepadqqApi.
-
#notepadqq ⇒ Object
Returns an instance of Notepadqq.
-
#runEventLoop ⇒ Object
Start reading messages and calling event handlers.
Constructor Details
#initialize(socketPath = ARGV[0], extensionId = ARGV[1]) ⇒ NotepadqqApi
Returns a new instance of NotepadqqApi.
11 12 13 14 15 16 17 |
# File 'lib/notepadqq_api.rb', line 11 def initialize(socketPath = ARGV[0], extensionId = ARGV[1]) @socketPath = socketPath @extensionId = extensionId = MessageChannel.new(@socketPath) = MessageInterpreter.new() end |
Instance Attribute Details
#extensionId ⇒ Object (readonly)
Returns the value of attribute extensionId.
9 10 11 |
# File 'lib/notepadqq_api.rb', line 9 def extensionId @extensionId end |
Instance Method Details
#notepadqq ⇒ Object
Returns an instance of Notepadqq
33 34 35 36 |
# File 'lib/notepadqq_api.rb', line 33 def notepadqq @nqq ||= Stubs::Notepadqq.new(, NQQ_STUB_ID); return @nqq end |
#runEventLoop ⇒ Object
Start reading messages and calling event handlers
20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/notepadqq_api.rb', line 20 def runEventLoop yield while true do = .getMessages .each do |msg| .processMessage(msg) end end end |