class Wisper::ValueObjects::Events

Describes allowed events

Duck-types the argument to quack like array of strings when responding to the {#include?} method call.

Public Class Methods

new(list) click to toggle source

@!scope class @!method new(on) Initializes a 'list' of events

@param [NilClass, String, Symbol, Array, Regexp] list

@raise [ArgumentError]

if an argument if of unsupported type

@return [undefined]

# File lib/wisper/value_objects/events.rb, line 19
def initialize(list)
  @list = list
end

Public Instance Methods

include?(event) click to toggle source

Check if given event is 'included' to the 'list' of events

@param [#to_s] event

@return [Boolean]

# File lib/wisper/value_objects/events.rb, line 28
def include?(event)
  appropriate_method.call(event.to_s)
end