Sha256: 155cb449be86c188baceca00587f04cfe703d6bbbfde9ea1b76ac685bc97e1bd

Contents?: true

Size: 913 Bytes

Versions: 10

Compression:

Stored size: 913 Bytes

Contents

module Compass
  module Configuration
    class Watch
      attr_reader :callback
      attr_reader :glob
      attr_reader :full_glob

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

        if Pathname.new(glob).absolute?
          @full_glob = glob
        else
          @full_glob = File.join(Compass.configuration.project_path, glob)
        end
      end

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

      def run_once_per_changeset?
        false
      end

      def match?(changed_path)
        File.fnmatch(full_glob, changed_path, File::FNM_PATHNAME)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 2 rubygems

Version Path
arcabouco-0.2.13 vendor/bundle/gems/compass-core-1.0.3/lib/compass/configuration/watch.rb
compass-core-1.0.3 lib/compass/configuration/watch.rb
compass-core-1.1.0.alpha.3 lib/compass/configuration/watch.rb
compass-core-1.1.0.alpha.2 lib/compass/configuration/watch.rb
compass-core-1.1.0.alpha.1 lib/compass/configuration/watch.rb
compass-core-1.1.0.alpha.0 lib/compass/configuration/watch.rb
compass-core-1.0.1 lib/compass/configuration/watch.rb
compass-core-1.0.0 lib/compass/configuration/watch.rb
compass-core-1.0.0.rc.1 lib/compass/configuration/watch.rb
compass-core-1.0.0.rc.0 lib/compass/configuration/watch.rb