Module: Textrepo
- Defined in:
- lib/textrepo.rb,
lib/textrepo/error.rb,
lib/textrepo/version.rb,
lib/textrepo/timestamp.rb,
lib/textrepo/repository.rb,
lib/textrepo/file_system_repository.rb
Defined Under Namespace
Modules: ErrMsg Classes: ArgumentRangeError, DuplicateTimestampError, EmptyTextError, Error, FileSystemRepository, InvalidSearchResultError, InvalidTimestampStringError, MissingTimestampError, Repository, Timestamp, UnknownRepoTypeError
Constant Summary collapse
- VERSION =
'0.5.10'
Class Method Summary collapse
-
.init(conf) ⇒ Object
Returns an instance which derived from Textrepo::Repository class.
Class Method Details
.init(conf) ⇒ Object
Returns an instance which derived from Textrepo::Repository class. ‘conf` must be an object which can be accessed like a Hash object. And it must also has a value of `:repository_type` and `:repository_name` at least. Some concrete class derived from Textrepo::Repository may require more key-value pairs in `conf`.
200 201 202 203 204 205 206 207 208 209 |
# File 'lib/textrepo/repository.rb', line 200 def init(conf) type = conf[:repository_type] klass_name = type.to_s.split(/_/).map(&:capitalize).join + "Repository" if Textrepo.const_defined?(klass_name) klass = Textrepo.const_get(klass_name, false) else raise UnknownRepoTypeError, type.nil? ? "(nil)" : type end klass.new(conf) end |