Class: GetFilePath

Inherits:
Object
  • Object
show all
Defined in:
lib/qiita_org/get_file_path.rb

Instance Method Summary collapse

Constructor Details

#initialize(src) ⇒ GetFilePath

Returns a new instance of GetFilePath.



2
3
4
# File 'lib/qiita_org/get_file_path.rb', line 2

def initialize(src)
  @src = src
end

Instance Method Details

#get_file_pathObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/qiita_org/get_file_path.rb', line 6

def get_file_path()
  lines = File.readlines(@src.gsub(".org", ".md"))
  files = []
  lines.each do |line|
    if path2 = line.match(/\!\[img\]\(((.+))"(.+)"\)/)
      files << path2[2]
    end
  end

  paths = []
  files.each do |file|
    paths << File.join(Dir.pwd, file)
  end
  return paths
end