Sha256: a2ebd4fee5ba2e657fb68fc6c7660110470ee93cfd006d8c48dc8a28be1358a3
Contents?: true
Size: 869 Bytes
Versions: 13
Compression:
Stored size: 869 Bytes
Contents
# -*- coding: utf-8 -*- require 'ostruct' module Xot module Invoker def initialize () end def handlers (create = false) if create @handlers ||= [] else @handlers ? @handlers : [] end end def add_handler (handler) return unless handler a = self.handlers true a.push handler unless a.include? handler end def remove_handler (handler) return unless handler self.handlers.delete handler end def invoke (name, attributes = {}, options = {}) only = options[:only] only = [only] if only && !only.kind_of?(Array) handlers = only ? only : @handlers return unless handlers handlers.each do |handler| handler.send name, OpenStruct.new(attributes) if handler.respond_to? name end end end# Invoker end# Xot
Version data entries
13 entries across 13 versions & 1 rubygems