Module: CachedRecord
- Defined in:
- lib/cached_record.rb,
lib/cached_record/base.rb
Defined Under Namespace
Classes: Base
Constant Summary collapse
- VERSION =
:stopdoc:
'0.0.1'
- LIBPATH =
::File.(::File.dirname(__FILE__)) + ::File::SEPARATOR
- PATH =
::File.dirname(LIBPATH) + ::File::SEPARATOR
Class Method Summary collapse
- .cache_store ⇒ Object
- .cache_store=(cache) ⇒ Object
-
.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 rquire 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.
Class Method Details
.cache_store ⇒ Object
31 32 33 |
# File 'lib/cached_record/base.rb', line 31 def self.cache_store @cache_store ||= ::CACHE end |
.cache_store=(cache) ⇒ Object
35 36 37 |
# File 'lib/cached_record/base.rb', line 35 def self.cache_store=(cache) @cache_store = cache 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
.
29 30 31 |
# File 'lib/cached_record.rb', line 29 def self.libpath( *args ) args.empty? ? LIBPATH : ::File.join(LIBPATH, *args) 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
.
37 38 39 |
# File 'lib/cached_record.rb', line 37 def self.path( *args ) args.empty? ? PATH : ::File.join(PATH, *args) end |
.require_all_libs_relative_to(fname, dir = nil) ⇒ Object
Utility method used to rquire 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.
46 47 48 49 50 51 52 |
# File 'lib/cached_record.rb', line 46 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.
21 22 23 |
# File 'lib/cached_record.rb', line 21 def self.version VERSION end |