Class: Houston::Extensions::Event
- Inherits:
-
Struct
- Object
- Struct
- Houston::Extensions::Event
- Defined in:
- lib/houston/boot/extensions/events.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
Returns the value of attribute description.
-
#name ⇒ Object
Returns the value of attribute name.
-
#params ⇒ Object
Returns the value of attribute params.
Instance Method Summary collapse
-
#initialize(name, options) ⇒ Event
constructor
A new instance of Event.
- #matches?(event_name) ⇒ Boolean
Constructor Details
#initialize(name, options) ⇒ Event
Returns a new instance of Event.
69 70 71 72 73 74 |
# File 'lib/houston/boot/extensions/events.rb', line 69 def initialize(name, ) super name, .fetch(:description), .fetch(:params, []) @matcher = Regexp.new("\\A#{name.gsub /\{([^:}]+)\}/, "(?<\\1>[^:]+)"}\\z") end |
Instance Attribute Details
#description ⇒ Object
Returns the value of attribute description
68 69 70 |
# File 'lib/houston/boot/extensions/events.rb', line 68 def description @description end |
#name ⇒ Object
Returns the value of attribute name
68 69 70 |
# File 'lib/houston/boot/extensions/events.rb', line 68 def name @name end |
#params ⇒ Object
Returns the value of attribute params
68 69 70 |
# File 'lib/houston/boot/extensions/events.rb', line 68 def params @params end |
Instance Method Details
#matches?(event_name) ⇒ Boolean
76 77 78 |
# File 'lib/houston/boot/extensions/events.rb', line 76 def matches?(event_name) @matcher === event_name # TODO: replace `===` with `.match?` on Ruby 2.4 end |