Class: Songbook::GenerateSongFile
- Inherits:
-
Object
- Object
- Songbook::GenerateSongFile
- Defined in:
- lib/songbook/generate_song_file.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) ⇒ GenerateSongFile
constructor
A new instance of GenerateSongFile.
Constructor Details
#initialize(input_path:, output_path:, verbose: false) ⇒ GenerateSongFile
Returns a new instance of GenerateSongFile.
11 12 13 14 15 |
# File 'lib/songbook/generate_song_file.rb', line 11 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.
9 10 11 |
# File 'lib/songbook/generate_song_file.rb', line 9 def input_path @input_path end |
#output_path ⇒ Object (readonly)
Returns the value of attribute output_path.
9 10 11 |
# File 'lib/songbook/generate_song_file.rb', line 9 def output_path @output_path end |
#verbose ⇒ Object (readonly)
Returns the value of attribute verbose.
9 10 11 |
# File 'lib/songbook/generate_song_file.rb', line 9 def verbose @verbose end |
Instance Method Details
#call ⇒ Object
17 18 19 20 21 |
# File 'lib/songbook/generate_song_file.rb', line 17 def call puts "Generating #{output_path}..." if verbose File.open(output_path, 'w') { |file| file.write(song_text) } end |