class Kamaze::Project::Tools::Yardoc::File

Describe a “file”

as seen from “YARD::CLI::Yardoc#files“ and “YARD::CLI::YardocOptions#files“, as result a file can be evaluating as a glob expression, else file (“filepath“) is a fixed string. Thus, file is castable to “Array“.

Attributes

filepath[R]

Public Class Methods

new(filepath, glob = false) click to toggle source

@param [String] filepath @param [Boolean] glob

# File lib/kamaze/project/tools/yardoc/file.rb, line 22
def initialize(filepath, glob = false)
  # noinspection RubySimplifyBooleanInspection
  @glob = !!glob
  @filepath = filepath.to_s
end

Public Instance Methods

glob?() click to toggle source

Denote file MUST be evaluated as a glob expression

@return [Boolean]

# File lib/kamaze/project/tools/yardoc/file.rb, line 42
def glob?
  @glob
end
paths() click to toggle source

@return [Array<Pathname>]

# File lib/kamaze/project/tools/yardoc/file.rb, line 29
def paths
  proc do
    if glob?
      Dir.glob(filepath).map { |f| Pathname.new(f).dirname }
    else
      [Pathname.new(filepath).dirname]
    end
  end.call.uniq.sort.map { |f| Pathname.new(f.to_s.gsub('./', '')) }
end
Also aliased as: to_a
to_a()
Alias for: paths
to_s() click to toggle source
# File lib/kamaze/project/tools/yardoc/file.rb, line 46
def to_s
  filepath
end