Module: PrePlay
- Defined in:
- lib/preplay/event.rb,
lib/preplay/event/version.rb
Defined Under Namespace
Classes: Event
Class Method Summary collapse
- .Event(event_type, data = {}, context = {}, opts = nil) ⇒ Object
-
.filter(data, event_type) ⇒ Object
will filter the hash that was given to keep only the data that we want to display on the logs depending on the data type.
Class Method Details
.Event(event_type, data = {}, context = {}, opts = nil) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 15 |
# File 'lib/preplay/event.rb', line 3 def self.Event(event_type, data = {}, context = {}, opts = nil) e = Event.new( { 'type' => event_type }.merge(filter(data, event_type)), context, { 'dyno'=> $dyno_name, 'created_at'=> Time.now.to_s } ) e.to_scrolls(opts) end |
.filter(data, event_type) ⇒ Object
will filter the hash that was given to keep only the data that we want to display on the logs depending on the data type
18 19 20 21 |
# File 'lib/preplay/event.rb', line 18 def self.filter(data, event_type) return {} unless PrePlay::Event.configuration.field_whitelist.has_key?(event_type) data.select {|k| PrePlay::Event.configuration.field_whitelist[event_type].include?(k)} end |