Class: Xpub::CallBook::CallMdFiles

Inherits:
Object
  • Object
show all
Defined in:
lib/xpub/dsl/src_file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(dir) ⇒ CallMdFiles

Returns a new instance of CallMdFiles.



65
66
67
# File 'lib/xpub/dsl/src_file.rb', line 65

def initialize(dir)
  @dir = dir
end

Instance Attribute Details

#dirObject (readonly)

Returns the value of attribute dir.



63
64
65
# File 'lib/xpub/dsl/src_file.rb', line 63

def dir
  @dir
end

Instance Method Details

#debugObject



86
87
88
# File 'lib/xpub/dsl/src_file.rb', line 86

def debug
  p full_path
end

#full_pathObject



69
70
71
# File 'lib/xpub/dsl/src_file.rb', line 69

def full_path
  "#{Dir.getwd}/src/#{@dir}"
end

#md_filesObject



77
78
79
80
81
82
83
84
# File 'lib/xpub/dsl/src_file.rb', line 77

def md_files
  validate
  Dir.glob("#{full_path}/**/*.md").sort.map do |path|
    mf = CallMdFile.new path.sub("#{Dir.getwd}/src/", '')
    mf.validate
    mf
  end
end

#validateObject



73
74
75
# File 'lib/xpub/dsl/src_file.rb', line 73

def validate
  raise "Markdown Dir does not exist.#{full_path}" unless Dir.exist? full_path
end