Class: LcpRuby::Events::HandlerBase
- Inherits:
-
Object
- Object
- LcpRuby::Events::HandlerBase
- Defined in:
- lib/lcp_ruby/events/handler_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#changes ⇒ Object
readonly
Returns the value of attribute changes.
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#current_user ⇒ Object
readonly
Returns the value of attribute current_user.
-
#event_name ⇒ Object
readonly
Returns the value of attribute event_name.
-
#record ⇒ Object
readonly
Returns the value of attribute record.
-
#request_params ⇒ Object
readonly
Returns the value of attribute request_params.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(context = {}) ⇒ HandlerBase
constructor
A new instance of HandlerBase.
Constructor Details
#initialize(context = {}) ⇒ HandlerBase
Returns a new instance of HandlerBase.
6 7 8 9 10 11 12 13 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 6 def initialize(context = {}) @context = context @record = context[:record] @changes = context[:changes] || {} @current_user = context[:current_user] @event_name = context[:event_name] @request_params = context[:request_params] || {} end |
Instance Attribute Details
#changes ⇒ Object (readonly)
Returns the value of attribute changes.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def changes @changes end |
#context ⇒ Object (readonly)
Returns the value of attribute context.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def context @context end |
#current_user ⇒ Object (readonly)
Returns the value of attribute current_user.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def current_user @current_user end |
#event_name ⇒ Object (readonly)
Returns the value of attribute event_name.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def event_name @event_name end |
#record ⇒ Object (readonly)
Returns the value of attribute record.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def record @record end |
#request_params ⇒ Object (readonly)
Returns the value of attribute request_params.
4 5 6 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 4 def request_params @request_params end |
Class Method Details
.async? ⇒ Boolean
23 24 25 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 23 def self.async? false end |
.handles_event ⇒ Object
19 20 21 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 19 def self.handles_event raise NotImplementedError, "#{name}.handles_event must be implemented" end |
Instance Method Details
#call ⇒ Object
15 16 17 |
# File 'lib/lcp_ruby/events/handler_base.rb', line 15 def call raise NotImplementedError, "#{self.class}#call must be implemented" end |