Module: Kamaze::Project::Tools::Yardoc::Watchable

Included in:
Kamaze::Project::Tools::Yardoc
Defined in:
lib/kamaze/project/tools/yardoc/watchable.rb,
lib/kamaze/project/tools/yardoc/watchable.rb

Overview

Provide watch related methods

Yardoc (wrapper class) is used by a Watcher using tools it MUST provide some methods used to:

  • initialize Listen
  • provide patterns (glob pattern matching)

Instance of YARD::CLI::Yardoc is retrieved through core method

Defined Under Namespace

Classes: File

Instance Method Summary collapse

Instance Method Details

#excludedArray<String>

Ignores files matching path match (regexp)

Returns:

  • (Array<String>)


67
68
69
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 67

def excluded
  core.excluded
end

#filesArray<Kamaze::Project::Tools::Yardoc::File>

Get files

Mostly patterns, addition of files with options.files SHOULD include README file, when .yardopts defined



57
58
59
60
61
62
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 57

def files
  [
    core.files.to_a.flatten.map { |f| File.new(f, true) },
    core.options.files.to_a.map { |f| File.new(f.filename, false) }
  ].flatten
end

#pathsArray<Pathname>

Get paths

Returns:

  • (Array<Pathname>)


37
38
39
40
41
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 37

def paths
  files.map do |file|
    file.to_a.sort[0]
  end.flatten.compact.uniq.sort
end

#patternsArray<String>

Get patterns (usable for glob pattern matching)

Returns:

  • (Array<String>)


46
47
48
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 46

def patterns
  files.map(&:to_s)
end