Class: Textus::CLI::Verb::Pulse

Inherits:
Textus::CLI::Verb show all
Defined in:
lib/textus/cli/verb/pulse.rb

Instance Attribute Summary

Attributes inherited from Textus::CLI::Verb

#positional

Instance Method Summary collapse

Methods inherited from Textus::CLI::Verb

command_name, #context_for, descendants, #emit, inherited, #initialize, needs_store?, option, options, parent_group, #parse, #resolved_role, #session_for

Constructor Details

This class inherits a constructor from Textus::CLI::Verb

Instance Method Details

#call(store) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/textus/cli/verb/pulse.rb', line 10

def call(store)
  role = resolved_role(store)
  ops = store.as(role)

  if since
    emit(ops.pulse(since: since.to_i))
  else
    cursors = Textus::CursorStore.new(root: store.root, role: role)
    result = ops.pulse(since: cursors.read)
    cursors.write(result["cursor"])
    emit(result)
  end
end