Class: WavefrontDisplay::Write
- Defined in:
- lib/wavefront-cli/display/write.rb
Overview
Format human-readable output when writing points. In this context data is a Hash of the form { sent: 1, rejected: 0, unsent: 0 }
Direct Known Subclasses
Constant Summary
Constants included from WavefrontCli::Constants
WavefrontCli::Constants::ALL_PAGE_SIZE, WavefrontCli::Constants::DEFAULT_CONFIG, WavefrontCli::Constants::DEFAULT_OPTS, WavefrontCli::Constants::EVENT_STATE_DIR, WavefrontCli::Constants::HUMAN_TIME_FORMAT, WavefrontCli::Constants::HUMAN_TIME_FORMAT_MS, WavefrontCli::Constants::SEARCH_SPLIT
Instance Attribute Summary collapse
-
#not_sent ⇒ Object
readonly
Returns the value of attribute not_sent.
Attributes inherited from Base
Instance Method Summary collapse
Methods inherited from Base
#_prioritize_keys, #display_brief_freetext_results, #do_delete, #do_import, #do_list, #do_list_brief, #do_list_fields, #do_queries, #do_search, #do_search_brief, #do_search_fields, #do_tag_add, #do_tag_clear, #do_tag_delete, #do_tag_pathsearch, #do_tag_set, #do_tags, #do_undelete, #drop_fields, #filter_data, #filter_fields_as_arr, #freetext_keys, #friendly_name, #human_time, #index_of_final_item, #initialize, #key_width, #long_output, #multicolumn, #pagination_line, #prioritize_keys, #priority_keys, #quoted, #readable_time, #readable_time_arr, #run, #run_error, #run_list, #run_search, #search_display_keys, #search_identifier_key, #time_formats
Constructor Details
This class inherits a constructor from WavefrontDisplay::Base
Instance Attribute Details
#not_sent ⇒ Object (readonly)
Returns the value of attribute not_sent.
11 12 13 |
# File 'lib/wavefront-cli/display/write.rb', line 11 def not_sent @not_sent end |
Instance Method Details
#do_file ⇒ Object
24 25 26 |
# File 'lib/wavefront-cli/display/write.rb', line 24 def do_file do_point end |
#do_point ⇒ Object
13 14 15 16 17 18 |
# File 'lib/wavefront-cli/display/write.rb', line 13 def do_point @not_sent = data['rejected'] + data['unsent'] report unless nothing_to_say? raise unless not_sent.zero? end |
#nothing_to_say? ⇒ Boolean
20 21 22 |
# File 'lib/wavefront-cli/display/write.rb', line 20 def nothing_to_say? [:quiet] || not_sent.positive? end |
#report ⇒ Object
28 29 30 31 32 33 34 |
# File 'lib/wavefront-cli/display/write.rb', line 28 def report %w[sent rejected unsent].each do |status| puts format(' %12<status>s %<count>d', status: status, count: data[status]) end end |