Class: RatProto::Commands::StreamLabels
- Defined in:
- lib/ratproto/commands/stream_labels.rb
Constant Summary
Constants inherited from Base
Base::DID_REGEXP, Base::HANDLE_REGEXP, Base::NSID_REGEXP
Instance Method Summary collapse
Instance Method Details
#execute ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/ratproto/commands/stream_labels.rb', line 31 def execute require 'skyfall' @labels = (label_types.length > 0) ? comma_separated(label_types, '-l/--labels') : nil @targets = (target_patterns.length > 0) ? target_patterns.map { |pattern| target_regexp(pattern) } : nil @service = determine_hostname(service) @sky = Skyfall::Firehose.new(@service, :subscribe_labels, cursor) configure_interrupt_handler if print_cursor? @sky. do |msg| print_cursor_and_stop(msg) next end @sky.connect else configure_callbacks @sky.connect log "Stopped stream at cursor #{@sky.cursor}" + (@last_timestamp ? " (#{@last_timestamp})" : "") end end |