Class: Serf::Handler::Event
- Inherits:
-
Object
- Object
- Serf::Handler::Event
- Defined in:
- lib/serf/handler/event.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#payload ⇒ Object
Returns the value of attribute payload.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(cli = {}) ⇒ Event
constructor
A new instance of Event.
Constructor Details
#initialize(cli = {}) ⇒ Event
Returns a new instance of Event.
6 7 8 9 10 11 12 |
# File 'lib/serf/handler/event.rb', line 6 def initialize(cli = {}) @type = cli[:type] || ENV['SERF_EVENT']&.to_sym || :query @type = :event if @type == :user @name = cli[:name] || ( @type == :query ? ENV['SERF_QUERY_NAME'] : ENV['SERF_USER_EVENT'] ) @payload = cli[:payload] || STDIN.read @payload.strip! end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/serf/handler/event.rb', line 4 def name @name end |
#payload ⇒ Object
Returns the value of attribute payload.
4 5 6 |
# File 'lib/serf/handler/event.rb', line 4 def payload @payload end |
#type ⇒ Object
Returns the value of attribute type.
4 5 6 |
# File 'lib/serf/handler/event.rb', line 4 def type @type end |