Class: Comet::FileOption
- Inherits:
-
Object
- Object
- Comet::FileOption
- Defined in:
- lib/comet/models/file_option.rb
Overview
This type is available in Comet 23.3.7 and later.
Instance Attribute Summary collapse
-
#allow_event_types ⇒ Object
Configure a subset of allowed event types (see SEVT_ constants).
-
#filename ⇒ Object
The prefix for the log filename.
-
#level ⇒ Object
One of the STREAM_LEVEL_ constants.
-
#pruning_enabled ⇒ Object
Enables pruning of log files.
-
#pruning_limit ⇒ Object
Limit in days to keep log files when PruningEnabled is set to true.
-
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
Instance Method Summary collapse
- #clear ⇒ Object
- #from_hash(obj) ⇒ Object
- #from_json(json_string) ⇒ Object
-
#initialize ⇒ FileOption
constructor
A new instance of FileOption.
-
#to_h ⇒ Hash
The complete object as a Ruby hash.
-
#to_hash ⇒ Hash
The complete object as a Ruby hash.
-
#to_json(options = {}) ⇒ String
The complete object as a JSON string.
Constructor Details
#initialize ⇒ FileOption
Returns a new instance of FileOption.
44 45 46 |
# File 'lib/comet/models/file_option.rb', line 44 def initialize clear end |
Instance Attribute Details
#allow_event_types ⇒ Object
Configure a subset of allowed event types (see SEVT_ constants). If the array is empty, all events will be sent
26 27 28 |
# File 'lib/comet/models/file_option.rb', line 26 def allow_event_types @allow_event_types end |
#filename ⇒ Object
The prefix for the log filename. It will be stored in the same file location as the Comet Server log files
21 22 23 |
# File 'lib/comet/models/file_option.rb', line 21 def filename @filename end |
#level ⇒ Object
One of the STREAM_LEVEL_ constants. This controls how much data is logged into the file
30 31 32 |
# File 'lib/comet/models/file_option.rb', line 30 def level @level end |
#pruning_enabled ⇒ Object
Enables pruning of log files
34 35 36 |
# File 'lib/comet/models/file_option.rb', line 34 def pruning_enabled @pruning_enabled end |
#pruning_limit ⇒ Object
Limit in days to keep log files when PruningEnabled is set to true. If not set or 0, uses server’s PruneLogsAfterDays
39 40 41 |
# File 'lib/comet/models/file_option.rb', line 39 def pruning_limit @pruning_limit end |
#unknown_json_fields ⇒ Object
Returns the value of attribute unknown_json_fields.
42 43 44 |
# File 'lib/comet/models/file_option.rb', line 42 def unknown_json_fields @unknown_json_fields end |
Instance Method Details
#clear ⇒ Object
48 49 50 51 52 53 54 |
# File 'lib/comet/models/file_option.rb', line 48 def clear @filename = '' @allow_event_types = [] @level = '' @pruning_limit = 0 @unknown_json_fields = {} end |
#from_hash(obj) ⇒ Object
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
# File 'lib/comet/models/file_option.rb', line 64 def from_hash(obj) raise TypeError, "'obj' expected Hash, got #{obj.class}" unless obj.is_a? Hash obj.each do |k, v| case k when 'Filename' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @filename = v when 'AllowEventTypes' if v.nil? @allow_event_types = [] else @allow_event_types = Array.new(v.length) v.each_with_index do |v1, i1| raise TypeError, "'v1' expected Numeric, got #{v1.class}" unless v1.is_a? Numeric @allow_event_types[i1] = v1 end end when 'Level' raise TypeError, "'v' expected String, got #{v.class}" unless v.is_a? String @level = v when 'PruningEnabled' @pruning_enabled = v when 'PruningLimit' raise TypeError, "'v' expected Numeric, got #{v.class}" unless v.is_a? Numeric @pruning_limit = v else @unknown_json_fields[k] = v end end end |
#from_json(json_string) ⇒ Object
57 58 59 60 61 |
# File 'lib/comet/models/file_option.rb', line 57 def from_json(json_string) raise TypeError, "'json_string' expected String, got #{json_string.class}" unless json_string.is_a? String from_hash(JSON.parse(json_string)) end |
#to_h ⇒ Hash
Returns The complete object as a Ruby hash.
123 124 125 |
# File 'lib/comet/models/file_option.rb', line 123 def to_h to_hash end |
#to_hash ⇒ Hash
Returns The complete object as a Ruby hash.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/comet/models/file_option.rb', line 101 def to_hash ret = {} ret['Filename'] = @filename unless @allow_event_types.nil? ret['AllowEventTypes'] = @allow_event_types end unless @level.nil? ret['Level'] = @level end unless @pruning_enabled.nil? ret['PruningEnabled'] = @pruning_enabled end unless @pruning_limit.nil? ret['PruningLimit'] = @pruning_limit end @unknown_json_fields.each do |k, v| ret[k] = v end ret end |
#to_json(options = {}) ⇒ String
Returns The complete object as a JSON string.
128 129 130 |
# File 'lib/comet/models/file_option.rb', line 128 def to_json( = {}) to_hash.to_json() end |