Module: Bindan
- Defined in:
- lib/bindan.rb,
lib/bindan/error.rb,
lib/bindan/version.rb,
lib/bindan/providers/envvar.rb,
lib/bindan/providers/storage.rb,
lib/bindan/providers/firestore.rb,
lib/bindan/emulators/firestore_controller.rb,
lib/bindan/emulators/gcs_server_controller.rb
Defined Under Namespace
Modules: Emulator, Provider
Classes: Error
Constant Summary
collapse
- VERSION =
"0.1.1"
Class Method Summary
collapse
Class Method Details
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'lib/bindan.rb', line 14
def configure(providers: {env: Bindan::Provider::Envvar.new}, &block)
if block.is_a? Proc
container = OpenStruct.new
block.call(container, Struct.new(*providers.keys).new(*providers.values))
if instance_variables.include?(:@_config)
instance_variable_set :@_config, container.freeze
end
container
else
warn "no block given for `configure'"
end
end
|
.extended(klass) ⇒ self
32
33
34
35
36
37
38
39
40
41
42
43
44
|
# File 'lib/bindan.rb', line 32
def self.extended(klass)
klass.instance_eval do
@_config = nil
def self.config
@_config
end
end
public :configure
end
|