Class: Alki::Assembly::Instance
- Inherits:
-
Delegator
- Object
- Delegator
- Alki::Assembly::Instance
- Defined in:
- lib/alki/assembly/instance.rb
Instance Method Summary collapse
- #__executor__ ⇒ Object
- #__getobj__ ⇒ Object
- #__reload__ ⇒ Object
- #__version__ ⇒ Object
-
#initialize(assembly_module, overrides) ⇒ Instance
constructor
A new instance of Instance.
- #inspect ⇒ Object
- #pretty_print(q) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(assembly_module, overrides) ⇒ Instance
Returns a new instance of Instance.
10 11 12 13 14 15 16 17 18 |
# File 'lib/alki/assembly/instance.rb', line 10 def initialize(assembly_module,overrides) @assembly_module = assembly_module @overrides = overrides @version = 0 @needs_load = true @lock = Concurrent::ReentrantReadWriteLock.new @obj = nil @executor = nil end |
Instance Method Details
#__executor__ ⇒ Object
37 38 39 40 41 42 |
# File 'lib/alki/assembly/instance.rb', line 37 def __executor__ @lock.with_read_lock do __load__ if @needs_load @executor end end |
#__getobj__ ⇒ Object
44 45 46 47 48 49 |
# File 'lib/alki/assembly/instance.rb', line 44 def __getobj__ @lock.with_read_lock do __load__ if @needs_load @obj end end |
#__reload__ ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/alki/assembly/instance.rb', line 20 def __reload__ @lock.with_read_lock do unless @needs_load @lock.with_write_lock do @version += 1 @needs_load = true end end end end |
#__version__ ⇒ Object
31 32 33 34 35 |
# File 'lib/alki/assembly/instance.rb', line 31 def __version__ @lock.with_read_lock do @version end end |
#inspect ⇒ Object
55 56 57 58 59 60 61 62 |
# File 'lib/alki/assembly/instance.rb', line 55 def inspect if @assembly_module.is_a?(Module) name = @assembly_module.name || 'AnonymousAssembly' else name = Alki::Support.classify(@assembly_module.to_s) end "#<#{name}:#{object_id}>" end |
#pretty_print(q) ⇒ Object
64 65 66 |
# File 'lib/alki/assembly/instance.rb', line 64 def pretty_print(q) q.text(inspect) end |
#to_s ⇒ Object
51 52 53 |
# File 'lib/alki/assembly/instance.rb', line 51 def to_s inspect end |