Sha256: 55cebc7489fffd1bd8c805e89a006e6e8b78f9a81bc1e55ff87d2d0f70507dd9

Contents?: true

Size: 1020 Bytes

Versions: 16

Compression:

Stored size: 1020 Bytes

Contents

module Compass
  module Watcher
    class BasicWatch
      attr_reader :callback

      def initialize(&block)
        unless block
          raise NoCallbackError, "A Block must be supplied in order to be watched"
        end
        @callback = block
      end

      def run_callback(base, relative, action)
        callback.call(base, relative, action)
      end

      def run_once_per_changeset?
        false
      end

      def match?(path)
        Sass::Util.abstract(self)
      end
    end

    class Watch < BasicWatch
      attr_reader :glob

      def initialize(glob, &block)
        super(&block)
        unless glob
          raise WatcherException, "A glob must be supplied in order to be watched"
        end
        @glob = glob
      end

      def match?(changed_path)
        File.fnmatch(glob, changed_path)
      end
    end

    class SassWatch < BasicWatch
      def match?(path)
        path =~ /s[ac]ss$/
      end
      def run_once_per_changeset?
        true
      end
    end
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
compass-1.0.0.alpha.21 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.20 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.19 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.18 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.17 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.16 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.15 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.14 lib/compass/watcher/watch.rb
compass-1.0.0.alpha.13 lib/compass/watcher/watch.rb
compass-0.13.alpha.12 lib/compass/watcher/watch.rb
compass-0.13.alpha.10 lib/compass/watcher/watch.rb
compass-0.13.alpha.9 lib/compass/watcher/watch.rb
compass-0.13.alpha.8 lib/compass/watcher/watch.rb
compass-0.13.alpha.7 lib/compass/watcher/watch.rb
compass-0.13.alpha.6 lib/compass/watcher/watch.rb
compass-0.13.alpha.5 lib/compass/watcher/watch.rb