Module: Schedsolver2
- Included in:
- Constraint, Schedule, School
- Defined in:
- lib/schedsolver2.rb,
lib/schedsolver2/school.rb,
lib/schedsolver2/teacher.rb,
lib/schedsolver2/version.rb,
lib/schedsolver2/schedule.rb,
lib/schedsolver2/constraint.rb,
lib/schedsolver2/ClassCounter.rb
Defined Under Namespace
Classes: ClassCounter, Constraint, InsanityError, Schedule, School, Teacher
Constant Summary collapse
- LIBPATH =
:stopdoc:
::File.('..', __FILE__) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
- VERSION =
"0.0.2"
Class Method Summary collapse
-
.libpath(*args) ⇒ Object
Returns the library path for the module.
-
.log ⇒ Object
Setup the module-scoped log.
- .log=(arg) ⇒ Object
-
.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.
Instance Method Summary collapse
Class Method Details
.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
.
38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/schedsolver2.rb', line 38 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 |
.log ⇒ Object
Setup the module-scoped log
18 19 20 |
# File 'lib/schedsolver2.rb', line 18 def self.log @log ||= Logger.new(STDOUT) end |
.log=(arg) ⇒ Object
22 23 24 |
# File 'lib/schedsolver2.rb', line 22 def self.log=(arg) @log = arg 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
.
55 56 57 58 59 60 61 62 63 64 65 66 |
# File 'lib/schedsolver2.rb', line 55 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.
73 74 75 76 77 78 79 |
# File 'lib/schedsolver2.rb', line 73 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 |
Instance Method Details
#log ⇒ Object
26 27 28 |
# File 'lib/schedsolver2.rb', line 26 def log Schedsolver2.log end |
#log=(arg) ⇒ Object
30 31 32 |
# File 'lib/schedsolver2.rb', line 30 def log=(arg) Schedsolver2.log = arg end |