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
#description, #external_attr, #external_tags, #fixed_attr, #fixed_tags, #host, #key, #source, #state, #time, #ttl, #value
Class Method Summary collapse
Instance Method Summary collapse
-
#attributes ⇒ Object
maintained for backwards compatibility, but implementors are encouraged to use internal/external attributes directly.
- #tags ⇒ Object
-
#to_h ⇒ Object
Convert event to a sparse hash.
Class Method Details
.make(opts = {}) ⇒ Object
49 50 51 52 53 54 |
# 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 |
Instance Method Details
#attributes ⇒ Object
maintained for backwards compatibility, but implementors are encouraged to use internal/external attributes directly.
58 59 60 |
# File 'lib/ffwd/event.rb', line 58 def attributes FFWD.merge_hashes fixed_attr, external_attr end |
#tags ⇒ Object
62 63 64 |
# File 'lib/ffwd/event.rb', line 62 def FFWD.merge_sets , end |
#to_h ⇒ Object
Convert event to a sparse hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# 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 = and not t.empty? d[:tags] = t end if a = attributes and not a.empty? d[:attributes] = a end d end |