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.
9 10 11 12 13 14 15 16 17 |
# File 'lib/alki/assembly/instance.rb', line 9 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
36 37 38 39 40 41 |
# File 'lib/alki/assembly/instance.rb', line 36 def __executor__ @lock.with_read_lock do __load__ if @needs_load @executor end end |
#__getobj__ ⇒ Object
43 44 45 46 47 48 |
# File 'lib/alki/assembly/instance.rb', line 43 def __getobj__ @lock.with_read_lock do __load__ if @needs_load @obj end end |
#__reload__ ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/alki/assembly/instance.rb', line 19 def __reload__ @lock.with_read_lock do if @obj @lock.with_write_lock do @needs_load = true @version+=1 end end end end |
#__version__ ⇒ Object
30 31 32 33 34 |
# File 'lib/alki/assembly/instance.rb', line 30 def __version__ @lock.with_read_lock do @version end end |
#inspect ⇒ Object
54 55 56 57 58 59 60 61 |
# File 'lib/alki/assembly/instance.rb', line 54 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
63 64 65 |
# File 'lib/alki/assembly/instance.rb', line 63 def pretty_print(q) q.text(inspect) end |
#to_s ⇒ Object
50 51 52 |
# File 'lib/alki/assembly/instance.rb', line 50 def to_s inspect end |