Sha256: 50c58ea871dd4418943badd78f2bc63a6b5bfc9052a99c5fbde3a86fbf7db65d
Contents?: true
Size: 864 Bytes
Versions: 13
Compression:
Stored size: 864 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