Class: Houston::Extensions::Event

Inherits:
Object
  • Object
show all
Defined in:
lib/houston/boot/extensions.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, options)
  @name = name
  @description = options.fetch(:description)
  @params = options.fetch(:params, [])
  @matcher = Regexp.new("\\A#{name.gsub /\{([^:}]+)\}/, "(?<\\1>[^:]+)"}\\z")
end

Instance Attribute Details

#descriptionObject (readonly)

Returns the value of attribute description.



349
350
351
# File 'lib/houston/boot/extensions.rb', line 349

def description
  @description
end

#nameObject (readonly)

Returns the value of attribute name.



349
350
351
# File 'lib/houston/boot/extensions.rb', line 349

def name
  @name
end

#paramsObject (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

Returns:

  • (Boolean)


358
359
360
# File 'lib/houston/boot/extensions.rb', line 358

def matches?(event_name)
  @matcher === event_name
end