Class: Songbook::GenerateSongFiles
- Inherits:
-
Object
- Object
- Songbook::GenerateSongFiles
- Defined in:
- lib/songbook/generate_song_files.rb
Instance Attribute Summary collapse
-
#input_path ⇒ Object
readonly
Returns the value of attribute input_path.
-
#output_path ⇒ Object
readonly
Returns the value of attribute output_path.
-
#verbose ⇒ Object
readonly
Returns the value of attribute verbose.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(input_path:, output_path:, verbose: false) ⇒ GenerateSongFiles
constructor
A new instance of GenerateSongFiles.
Constructor Details
#initialize(input_path:, output_path:, verbose: false) ⇒ GenerateSongFiles
Returns a new instance of GenerateSongFiles.
9 10 11 12 13 |
# File 'lib/songbook/generate_song_files.rb', line 9 def initialize(input_path:, output_path:, verbose: false) @input_path = input_path @output_path = output_path @verbose = verbose end |
Instance Attribute Details
#input_path ⇒ Object (readonly)
Returns the value of attribute input_path.
7 8 9 |
# File 'lib/songbook/generate_song_files.rb', line 7 def input_path @input_path end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
7 8 9 |
# File 'lib/songbook/generate_song_files.rb', line 7 def output_path @output_path end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
7 8 9 |
# File 'lib/songbook/generate_song_files.rb', line 7 def verbose @verbose end |
Instance Method Details
#call ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/songbook/generate_song_files.rb', line 15 def call Dir.glob("#{input_path}/*.yml") do |filename| basename = File.basename(filename, '.yml') output_file = "#{output_path}/#{basename}.txt" service = GenerateSongFile.new( input_path: filename, output_path: output_file, verbose: verbose ) service.call end end |