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

Included in:
Kamaze::Project::Tools::Yardoc
Defined in:
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>)


61
62
63
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 61

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



49
50
51
52
53
54
55
56
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 49

def files
  # @formatter:off
  [
    core.files.to_a.flatten.map { |f| File.new(f, true) },
    core.options.files.to_a.map { |f| File.new(f.filename, false) }
  ].flatten
  # @formatter:on
end

#pathsArray<Pathname>

Get paths

Returns:

  • (Array<Pathname>)


29
30
31
32
33
# File 'lib/kamaze/project/tools/yardoc/watchable.rb', line 29

def paths
  files.map do |file|
    file.to_a.min
  end.flatten.compact.uniq.sort
end

#patternsArray<String>

Get patterns (usable for glob pattern matching)

Returns:

  • (Array<String>)


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

def patterns
  files.map(&:to_s)
end