Module: Sqrbl
- Defined in:
- lib/sqrbl.rb,
lib/sqrbl/step.rb,
lib/sqrbl/group.rb,
lib/sqrbl/step_pair.rb,
lib/sqrbl/call_stack.rb,
lib/sqrbl/conversion.rb,
lib/sqrbl/mixins/has_todos.rb,
lib/sqrbl/base_conversion_writer.rb,
lib/sqrbl/unified_conversion_writer.rb,
lib/sqrbl/individual_conversion_writer.rb,
lib/sqrbl/mixins/expects_block_with_new.rb,
lib/sqrbl/mixins/method_missing_delegation.rb
Overview
This file is part of SQrbL, which is free software licensed under v3 of the GNU GPL. For more information, please see README.txt and LICENSE.txt in the project’s root directory.
Most of this was autogenerated by the ‘bones’ gem. The primary domain-specific method of interest here is Sqrbl.conversion.
Defined Under Namespace
Modules: CallStack, ExpectsBlockWithNew, HasTodos, MethodMissingDelegation Classes: BaseConversionWriter, Conversion, Group, IndividualConversionWriter, Step, StepPair, UnifiedConversionWriter
Constant Summary collapse
- VERSION =
:stopdoc:
'0.2.0'
- LIBPATH =
::File.(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
Class Method Summary collapse
-
.build_conversion(&block) ⇒ Object
Convenience method: Calls Sqrbl::Conversion.build and passes it the given block.
-
.calculate_unix_name(string) ⇒ Object
Returns the string, in lower case, with whitespace converted to underscores and all non-alphanumeric characters removed.
-
.conversion(&block) ⇒ Object
Convenience method: builds and writes a conversion in one go.
-
.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.
-
.version ⇒ Object
Returns the version string for the library.
-
.write_conversion!(conversion) ⇒ Object
Convenience method: Write a Conversion using all subclasses of BaseConversionWriter.
Class Method Details
.build_conversion(&block) ⇒ Object
Convenience method: Calls Sqrbl::Conversion.build and passes it the given block.
57 58 59 |
# File 'lib/sqrbl.rb', line 57 def self.build_conversion(&block) Sqrbl::Conversion.build(&block) end |
.calculate_unix_name(string) ⇒ Object
Returns the string, in lower case, with whitespace converted to underscores and all non-alphanumeric characters removed.
70 71 72 |
# File 'lib/sqrbl.rb', line 70 def self.calculate_unix_name(string) string.gsub(/\s+/, '_').downcase.gsub(/[^a-z0-9_]/, '') end |
.conversion(&block) ⇒ Object
Convenience method: builds and writes a conversion in one go.
50 51 52 53 54 |
# File 'lib/sqrbl.rb', line 50 def self.conversion(&block) returning(build_conversion(&block)) do |cvn| write_conversion!(cvn) end 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
.
24 25 26 |
# File 'lib/sqrbl.rb', line 24 def self.libpath( *args ) args.empty? ? LIBPATH : ::File.join(LIBPATH, args.flatten) 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
.
32 33 34 |
# File 'lib/sqrbl.rb', line 32 def self.path( *args ) args.empty? ? PATH : ::File.join(PATH, args.flatten) 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.
41 42 43 44 45 46 47 |
# File 'lib/sqrbl.rb', line 41 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 |
.version ⇒ Object
Returns the version string for the library.
16 17 18 |
# File 'lib/sqrbl.rb', line 16 def self.version VERSION end |
.write_conversion!(conversion) ⇒ Object
Convenience method: Write a Conversion using all subclasses of BaseConversionWriter.
62 63 64 65 66 |
# File 'lib/sqrbl.rb', line 62 def self.write_conversion!(conversion) BaseConversionWriter.subclasses.each do |writer_class| writer_class.write_conversion!(conversion) end end |