Class: Kamaze::Project::Tools::Yardoc::File
- Defined in:
- lib/kamaze/project/tools/yardoc/file.rb
Overview
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
.
Direct Known Subclasses
Instance Attribute Summary collapse
-
#filepath ⇒ Object
readonly
protected
Returns the value of attribute filepath.
Instance Method Summary collapse
-
#glob? ⇒ Boolean
Denote file MUST be evaluated as a glob expression.
-
#initialize(filepath, glob = false) ⇒ File
constructor
A new instance of File.
- #paths ⇒ Array<Pathname> (also: #to_a)
- #to_s ⇒ Object
Constructor Details
#initialize(filepath, glob = false) ⇒ File
Returns a new instance of File.
22 23 24 25 26 |
# File 'lib/kamaze/project/tools/yardoc/file.rb', line 22 def initialize(filepath, glob = false) # noinspection RubySimplifyBooleanInspection @glob = !!glob @filepath = filepath.to_s end |
Instance Attribute Details
#filepath ⇒ Object (readonly, protected)
Returns the value of attribute filepath.
54 55 56 |
# File 'lib/kamaze/project/tools/yardoc/file.rb', line 54 def filepath @filepath end |
Instance Method Details
#glob? ⇒ Boolean
Denote file MUST be evaluated as a glob expression
42 43 44 |
# File 'lib/kamaze/project/tools/yardoc/file.rb', line 42 def glob? @glob end |
#paths ⇒ Array<Pathname> Also known as: to_a
29 30 31 32 33 34 35 36 37 |
# 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 |
#to_s ⇒ Object
46 47 48 |
# File 'lib/kamaze/project/tools/yardoc/file.rb', line 46 def to_s filepath end |