Class: Houston::Extensions::Event
- Inherits:
-
Object
- Object
- Houston::Extensions::Event
- Defined in:
- lib/houston/boot/extensions.rb
Instance Attribute Summary collapse
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#params ⇒ Object
readonly
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.
351 352 353 354 355 356 |
# File 'lib/houston/boot/extensions.rb', line 351 def initialize(name, ) @name = name @description = .fetch(:description) @params = .fetch(:params, []) @matcher = Regexp.new("\\A#{name.gsub /\{([^:}]+)\}/, "(?<\\1>[^:]+)"}\\z") end |
Instance Attribute Details
#description ⇒ Object (readonly)
Returns the value of attribute description.
349 350 351 |
# File 'lib/houston/boot/extensions.rb', line 349 def description @description end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
349 350 351 |
# File 'lib/houston/boot/extensions.rb', line 349 def name @name end |
#params ⇒ Object (readonly)
Returns the value of attribute params.
349 350 351 |
# File 'lib/houston/boot/extensions.rb', line 349 def params @params end |
Instance Method Details
#matches?(event_name) ⇒ Boolean
358 359 360 |
# File 'lib/houston/boot/extensions.rb', line 358 def matches?(event_name) @matcher === event_name end |