Class: Jaina::Parser::AST::Context
- Inherits:
-
Object
- Object
- Jaina::Parser::AST::Context
- Defined in:
- lib/jaina/parser/ast/context.rb
Overview
Constant Summary collapse
- Error =
Class.new(StandardError)
- UndefinedContextKeyError =
Class.new(Error)
Instance Method Summary collapse
- #get(key) ⇒ Any
- #initialize(**initial_context) ⇒ void constructor private
- #keys ⇒ Array<Any>
- #set(key, value) ⇒ Any
Constructor Details
#initialize(**initial_context) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
16 17 18 19 |
# File 'lib/jaina/parser/ast/context.rb', line 16 def initialize(**initial_context) @data = {}.merge!(initial_context) @access_lock = Mutex.new end |
Instance Method Details
#get(key) ⇒ Any
36 37 38 |
# File 'lib/jaina/parser/ast/context.rb', line 36 def get(key) thread_safe { fetch(key) } end |
#keys ⇒ Array<Any>
44 45 46 |
# File 'lib/jaina/parser/ast/context.rb', line 44 def keys thread_safe { registered_data } end |
#set(key, value) ⇒ Any
27 28 29 |
# File 'lib/jaina/parser/ast/context.rb', line 27 def set(key, value) thread_safe { apply(key, value) } end |