Class: HasuraHandler::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/hasura_handler/event_handler.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ EventHandler

Returns a new instance of EventHandler.



21
22
23
# File 'lib/hasura_handler/event_handler.rb', line 21

def initialize(event)
  @event = event
end

Class Attribute Details

.hasura_matchersObject (readonly)

Returns the value of attribute hasura_matchers.



4
5
6
# File 'lib/hasura_handler/event_handler.rb', line 4

def hasura_matchers
  @hasura_matchers
end

Instance Attribute Details

#eventObject (readonly)

Returns the value of attribute event.



19
20
21
# File 'lib/hasura_handler/event_handler.rb', line 19

def event
  @event
end

Class Method Details

.match_by(matchers) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/hasura_handler/event_handler.rb', line 6

def match_by(matchers)
  raise 'matcher must be a hash' unless matchers.is_a?(Hash)
  allowed_matchers = [:table, :trigger, :op]

  matchers.keys.each do |matcher|
    raise 'invalid matcher' unless allowed_matchers.include?(matcher)
    raise 'invalid matcher value' unless matchers[matcher].is_a?(String)
  end

  @hasura_matchers = matchers
end