Class: WavefrontDisplay::Write

Inherits:
Base
  • Object
show all
Defined in:
lib/wavefront-cli/display/write.rb

Overview

Format human-readable output when writing points.

Direct Known Subclasses

Distribution

Constant Summary

Constants included from WavefrontCli::Constants

WavefrontCli::Constants::ALL_PAGE_SIZE, WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS

Instance Attribute Summary

Attributes inherited from Base

#data, #options, #raw

Instance Method Summary collapse

Methods inherited from Base

#do_delete, #do_import, #do_list, #do_list_brief, #do_queries, #do_search, #do_search_brief, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #friendly_name, #human_time, #initialize, #key_width, #long_output, #multicolumn, #pagination_line, #put_id_first, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search, #time_formats

Constructor Details

This class inherits a constructor from WavefrontDisplay::Base

Instance Method Details

#do_fileObject

rubocop:enable Metrics/AbcSize



14
15
16
# File 'lib/wavefront-cli/display/write.rb', line 14

def do_file
  do_point
end

#do_pointObject

rubocop:disable Metrics/AbcSize



8
9
10
11
# File 'lib/wavefront-cli/display/write.rb', line 8

def do_point
  report unless options[:quiet] || (data[:unsent] + data[:rejected] > 0)
  exit(data.rejected.zero? && data.unsent.zero? ? 0 : 1)
end

#reportObject



18
19
20
21
22
# File 'lib/wavefront-cli/display/write.rb', line 18

def report
  i[sent rejected unsent].each do |k|
    puts format('  %12s %d', k.to_s, data[k])
  end
end