Class: BiblioTech::Builders::Base

Inherits:
Object
  • Object
show all
Includes:
Caliph::CommandLineDSL
Defined in:
lib/bibliotech/builders.rb

Direct Known Subclasses

Database, File, NullAdapter

Defined Under Namespace

Classes: AdapterRegistry

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ Base

Returns a new instance of Base.



71
72
73
# File 'lib/bibliotech/builders.rb', line 71

def initialize(config)
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



74
75
76
# File 'lib/bibliotech/builders.rb', line 74

def config
  @config
end

Class Method Details

.adapter_registryObject



50
51
52
# File 'lib/bibliotech/builders.rb', line 50

def adapter_registry
  registry_host.registry
end

.for(config) ⇒ Object



62
63
64
# File 'lib/bibliotech/builders.rb', line 62

def for(config)
  find_class(config).new(config)
end

.null_adapterObject



66
67
68
# File 'lib/bibliotech/builders.rb', line 66

def null_adapter
  NullAdapter
end

.register(adapter_name) ⇒ Object



46
47
48
# File 'lib/bibliotech/builders.rb', line 46

def register(adapter_name)
  adapter_registry.put(adapter_name, self)
end

.registryObject



54
55
56
# File 'lib/bibliotech/builders.rb', line 54

def registry
  @registry ||= AdapterRegistry.new
end

.supported_adaptersObject



58
59
60
# File 'lib/bibliotech/builders.rb', line 58

def supported_adapters
  adapter_registry.keys
end