Method: Journaltxt.build_file

Defined in:
lib/journaltxt.rb

.build_file(path, opts = {}) ⇒ Object



79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/journaltxt.rb', line 79

def self.build_file( path, opts={} )
  text = File.open( path, 'r:bom|utf-8' ).read

  ## note: remove .txt extension if present for basename
  basename = File.basename( path, '.txt' )
  puts "basename:"
  pp basename

  ## note: only overwrite if NOT user-supplied
  opts[:name] ||= basename

  build( text, opts )
end