Module: Songbook

Defined in:
lib/songbook.rb,
lib/songbook/song.rb,
lib/songbook/verse.rb,
lib/songbook/version.rb,
lib/songbook/render_song.rb,
lib/songbook/generate_song_file.rb,
lib/songbook/generate_song_files.rb

Defined Under Namespace

Classes: GenerateSongFile, GenerateSongFiles, RenderSong, Song, Verse

Constant Summary collapse

VERSION =
'0.3.0'

Class Method Summary collapse

Class Method Details

.select_input_path(path) ⇒ Object



7
8
9
# File 'lib/songbook.rb', line 7

def self.select_input_path(path)
  path || '.'
end

.select_output_path(input_path:, output_path:) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/songbook.rb', line 11

def self.select_output_path(input_path:, output_path:)
  if output_path
    output_path
  elsif !Pathname.new(input_path).exist?
    raise "Cannot find input_path '#{input_path}'"
  elsif Pathname.new(input_path).file?
    input_path.sub(/\.ya?ml$/, '.txt')
  else
    input_path
  end
end