Class: ValueTracking

Inherits:
Object
  • Object
show all
Defined in:
lib/logstash/inputs/value_tracking.rb

Direct Known Subclasses

DateTimeValueTracker

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(handler) ⇒ ValueTracking

Returns a new instance of ValueTracking.



17
18
19
20
# File 'lib/logstash/inputs/value_tracking.rb', line 17

def initialize(handler)
  @file_handler = handler
  set_value(get_initial)
end

Instance Attribute Details

#valueObject (readonly)

Returns the value of attribute value.



15
16
17
# File 'lib/logstash/inputs/value_tracking.rb', line 15

def value
  @value
end

Class Method Details

.build_last_value_tracker(plugin) ⇒ Object



4
5
6
7
8
9
10
11
12
13
# File 'lib/logstash/inputs/value_tracking.rb', line 4

def self.build_last_value_tracker(plugin)
  handler = NullFileHandler.new(plugin.)
  if plugin.record_last_run
    handler = FileHandler.new(plugin.)
  end
  if plugin.clean_run
    handler.clean
  end
  instance = DateTimeValueTracker.new(handler)
end

Instance Method Details

#get_initialObject



22
23
24
# File 'lib/logstash/inputs/value_tracking.rb', line 22

def get_initial
  # override in subclass
end

#set_value(value) ⇒ Object



26
27
28
# File 'lib/logstash/inputs/value_tracking.rb', line 26

def set_value(value)
  # override in subclass
end

#writeObject



30
31
32
# File 'lib/logstash/inputs/value_tracking.rb', line 30

def write
  @file_handler.write(@value.to_s)
end