Class: FFWD::Event
- Inherits:
-
EventStruct
- Object
- Struct
- EventStruct
- FFWD::Event
- Defined in:
- lib/ffwd/event.rb
Overview
A convenience class for each individual event.
Instance Attribute Summary
Attributes inherited from EventStruct
#attributes, #description, #host, #key, #source, #state, #tags, #time, #ttl, #value
Class Method Summary collapse
Instance Method Summary collapse
-
#to_h ⇒ Object
Convert event to a sparse hash.
Class Method Details
.make(opts = {}) ⇒ Object
43 44 45 46 47 |
# File 'lib/ffwd/event.rb', line 43 def self.make opts = {} new(opts[:time], opts[:key], opts[:value], opts[:host], opts[:source], opts[:state], opts[:description], opts[:ttl], opts[:tags], opts[:attributes]) end |
Instance Method Details
#to_h ⇒ Object
Convert event to a sparse hash.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/ffwd/event.rb', line 50 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 d[:tags] = .to_a if d[:attributes] = attributes if attributes d end |