Sha256: a2b97bb2c7eee89b0dc6b557820f5f2bd60042f6d17953046f63a21388f327c3

Contents?: true

Size: 1.29 KB

Versions: 6

Compression:

Stored size: 1.29 KB

Contents

# Author::    Nicolas Pouillard  <ertai@lrde.epita.fr>.
# Copyright:: Copyright (c) 2004, 2005 Uttk team. All rights reserved.
# License::   LGPL
# $Id: /w/fey/uttk/trunk/lib/uttk/filters/Filter.rb 22184 2006-02-23T16:12:25.225774Z pouillar  $


module Uttk

  # A tutorial introduces how to create new filters at
  # http://uttk.org/shelf/documentation
  module Filters


    # FIXME: document me
    class Filter < Logger::Backend
      include Abstract
      include Observable

      class_inheritable_hash :default_options
      self.default_options = {}

      def initialize ( observers=[], options=nil )
        @options = default_options.merge(options || {})
        observers.each do |obs|
          raise ObserverError, obs unless obs.respond_to? :update
          add_observer(obs)
        end
        super()
      end

      def notif ( *args )
        changed
        notify_observers(*args)
      end

      def self.composition ( *desc )
        class_eval do
          @@desc = desc
          def initialize ( *a, &b )
            super()
            Filters[*@@desc].each do |obs|
              raise ObserverError, obs unless obs.respond_to? :update
              add_observer(obs)
            end
          end
        end
      end

    end # class Filter

  end # module Filters

end # module Uttk

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
uttk-0.3.5.0 lib/uttk/filters/Filter.rb
uttk-0.3.6.1 lib/uttk/filters/Filter.rb
uttk-0.3.1.2 lib/uttk/filters/Filter.rb
uttk-0.4.6.1 lib/uttk/filters/Filter.rb
uttk-0.4.5.0 lib/uttk/filters/Filter.rb
uttk-0.4.6.2 lib/uttk/filters/Filter.rb