Module: Lossfully
- Defined in:
- lib/lossfully.rb,
lib/lossfully/generator.rb,
lib/lossfully/audio_file.rb,
lib/lossfully/input_rules.rb,
lib/lossfully/thread_pool.rb
Overview
– Copyright © 2011 Don March
This file is part of Lossfully.
Lossfully is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
Lossfully is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with this program. If not, see <www.gnu.org/licenses/>. ++
Defined Under Namespace
Classes: AudioFile, Generator, InputRules, ThreadPool
Constant Summary collapse
- LIBPATH =
:stopdoc:
::File.(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
- VERSION =
:startdoc:
::File.read(PATH + 'version.txt').strip
- LOSSLESS_TYPES =
%w(wav flac wv sox).map(&:to_sym)
Class Method Summary collapse
-
.generate(*args, &block) ⇒ Object
Create a new Generator instance, yield it to the block (or call instance_eval, if arity==0), and then call generate on the instance.
-
.libpath(*args) ⇒ Object
Returns the library path for the module.
-
.path(*args) ⇒ Object
Returns the lpath for the module.
-
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in.
Class Method Details
.generate(*args, &block) ⇒ Object
Create a new Generator instance, yield it to the block (or call instance_eval, if arity==0), and then call generate on the instance.
594 595 596 597 |
# File 'lib/lossfully/generator.rb', line 594 def self.generate *args, &block g = Generator.new(&block) g.generate(*args) end |
.libpath(*args) ⇒ Object
Returns the library path for the module. If any arguments are given, they will be joined to the end of the libray path using File.join
.
33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/lossfully.rb', line 33 def self.libpath( *args ) rv = args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten) if block_given? begin $LOAD_PATH.unshift LIBPATH rv = yield ensure $LOAD_PATH.shift end end return rv end |
.path(*args) ⇒ Object
Returns the lpath for the module. If any arguments are given, they will be joined to the end of the path using File.join
.
50 51 52 53 54 55 56 57 58 59 60 61 |
# File 'lib/lossfully.rb', line 50 def self.path( *args ) rv = args.empty? ? PATH : ::File.join(PATH, args.flatten) if block_given? begin $LOAD_PATH.unshift PATH rv = yield ensure $LOAD_PATH.shift end end return rv end |
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to require all files ending in .rb that lie in the directory below this file that has the same name as the filename passed in. Optionally, a specific directory name can be passed in such that the filename does not have to be equivalent to the directory.
68 69 70 71 72 73 74 |
# File 'lib/lossfully.rb', line 68 def self.require_all_libs_relative_to( fname, dir = nil ) dir ||= ::File.basename(fname, '.*') search_me = ::File.( ::File.join(::File.dirname(fname), dir, '**', '*.rb')) Dir.glob(search_me).sort.each {|rb| require rb} end |