Class: Rox::Core::MergedContext

Inherits:
Object
  • Object
show all
Defined in:
lib/rox/core/context/merged_context.rb

Instance Method Summary collapse

Constructor Details

#initialize(global_context, local_context) ⇒ MergedContext

Returns a new instance of MergedContext.



4
5
6
7
# File 'lib/rox/core/context/merged_context.rb', line 4

def initialize(global_context, local_context)
  @global_context = global_context
  @local_context = local_context
end

Instance Method Details

#[](key) ⇒ Object



9
10
11
12
13
14
# File 'lib/rox/core/context/merged_context.rb', line 9

def [](key)
  return @local_context[key] unless @local_context.nil? || @local_context[key].nil?
  return @global_context[key] unless @global_context.nil?

  nil
end