class FFWD::Event

A convenience class for each individual event.

Public Class Methods

make(opts = {}) click to toggle source
# File lib/ffwd/event.rb, line 49
def self.make opts = {}
  new(opts[:time], opts[:key], opts[:value], opts[:host], opts[:source],
      opts[:state], opts[:description], opts[:ttl],
      opts[:tags], opts[:fixed_tags],
      opts[:attributes], opts[:fixed_attr])
end

Public Instance Methods

attributes() click to toggle source

maintained for backwards compatibility, but implementors are encouraged to use internal/external attributes directly.

# File lib/ffwd/event.rb, line 58
def attributes
  FFWD.merge_hashes fixed_attr, external_attr
end
tags() click to toggle source
# File lib/ffwd/event.rb, line 62
def tags
  FFWD.merge_sets fixed_tags, external_tags
end
to_h() click to toggle source

Convert event to a sparse hash.

# File lib/ffwd/event.rb, line 67
def to_h
  d = {}
  d[:time] = time.to_i if time
  d[:key] = key if key
  d[:value] = value if value
  d[:host] = host if host
  d[:source] = source if source
  d[:state] = state if state
  d[:description] = description if description
  d[:ttl] = ttl if ttl

  if t = tags and not t.empty?
    d[:tags] = t
  end

  if a = attributes and not a.empty?
    d[:attributes] = a
  end

  d
end