Sha256: 2293557908bdd121a6e7ece01ef2e2aea51a2da2c07e61a8d5150430d027318a
Contents?: true
Size: 944 Bytes
Versions: 1
Compression:
Stored size: 944 Bytes
Contents
require "optparse" require "mml2wav/version" require "mml2wav/wave" module Mml2wav class Command def self.run(arguments) new(arguments).run end def initialize(arguments) @options = parse_options(arguments) @sounds = ARGF.readlines.join(" ") end def run Wave.write(@sounds, @options) end private def parse_options(arguments) options = {} parser = OptionParser.new("#{$0} INPUT_FILE") parser.version = VERSION parser.on("--output=FILE", "Specify output file path") do |path| options[:output] = path end parser.on("--sampling_rate=RATE", "Specify sampling rate", Integer) do |rate| options[:sampling_rate] = rate end parser.parse!(arguments) unless File.pipe?('/dev/stdin') || IO.select([ARGF], nil, nil, 0) puts(parser.help) exit(true) end options end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
mml2wav-0.0.1 | lib/mml2wav/command.rb |