Module: Guard::CoffeeScript::Inspector

Defined in:
lib/guard/coffeescript/inspector.rb

Overview

The inspector verifies of the changed paths are valid for Guard::CoffeeScript.

Class Method Summary collapse

Class Method Details

.clean(paths, options = {}) ⇒ Array<String>

Clean the changed paths and return only valid CoffeeScript files.

Parameters:

  • paths (Array<String>)

    the changed paths

  • options (Hash) (defaults to: {})

    the clean options

Options Hash (options):

  • :missing_ok (String)

    don't remove missing files from list

Returns:

  • (Array<String>)

    the valid spec files



16
17
18
19
20
# File 'lib/guard/coffeescript/inspector.rb', line 16

def clean(paths, options = {})
  paths.uniq!
  paths.compact!
  paths.select { |p| coffee_file?(p, options) }
end

.coffee_file?(path, options) ⇒ Boolean (private)

Tests if the file is valid.

Parameters:

  • path (String)

    the file

  • options (Hash)

    the clean options

Options Hash (options):

  • :missing_ok (String)

    don't remove missing files from list

Returns:

  • (Boolean)

    when the file valid



31
32
33
# File 'lib/guard/coffeescript/inspector.rb', line 31

def coffee_file?(path, options)
  path =~ /\.(?:coffee|coffee\.md|litcoffee)$/ && (options[:missing_ok] || File.exist?(path))
end