Class: Objectify::Config::Injectables

Inherits:
Object
  • Object
show all
Defined in:
lib/objectify/config/injectables.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Injectables

Returns a new instance of Injectables.



7
8
9
# File 'lib/objectify/config/injectables.rb', line 7

def initialize(config = {})
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



4
5
6
# File 'lib/objectify/config/injectables.rb', line 4

def config
  @config
end

#contextObject



27
28
29
# File 'lib/objectify/config/injectables.rb', line 27

def context
  @context && @context.config || {}
end

Instance Method Details

#add_implementation(name, value) ⇒ Object



19
20
21
# File 'lib/objectify/config/injectables.rb', line 19

def add_implementation(name, value)
  @config[name] = [:implementation, value]
end

#add_resolver(name, value) ⇒ Object



11
12
13
# File 'lib/objectify/config/injectables.rb', line 11

def add_resolver(name, value)
  @config[name] = [:resolver, value]
end

#add_value(name, value) ⇒ Object



15
16
17
# File 'lib/objectify/config/injectables.rb', line 15

def add_value(name, value)
  @config[name] = [:value, value]
end

#get(name) ⇒ Object



23
24
25
# File 'lib/objectify/config/injectables.rb', line 23

def get(name)
  @config[name] || context[name] || [:unknown, name]
end

#merge(other) ⇒ Object



31
32
33
# File 'lib/objectify/config/injectables.rb', line 31

def merge(other)
  self.class.new @config.merge(other.config)
end