Class: Conject::ObjectContext

Inherits:
Object
  • Object
show all
Defined in:
lib/gamebox/lib/conject_ext.rb

Instance Method Summary collapse

Instance Method Details

#directly_has?(name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/gamebox/lib/conject_ext.rb', line 6

def directly_has?(name)
  @cache.has_key?(name.to_sym) or has_config?(name.to_sym)
end

#get(name) ⇒ Object



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gamebox/lib/conject_ext.rb', line 9

def get(name)
  name = name.to_sym
  return @cache[name] if @cache.has_key?(name)
  
  if !has_config?(name) and parent_context and parent_context.has?(name)
    return parent_context.get(name)
  else
    object = object_factory.construct_new(name,self)
    object.instance_variable_set(:@_conject_contextual_name, name.to_s)
    @cache[name] = object unless no_cache?(name)
    return object
  end
end

#has_config?(name) ⇒ Boolean

Returns:

  • (Boolean)


3
4
5
# File 'lib/gamebox/lib/conject_ext.rb', line 3

def has_config?(name)
  @object_configs.has_key?(name.to_sym)
end