Class: Knj::Thread
Overview
This class behaves like a normal thread - but it shows error-messages and tracebacks. Normal threads dont do that.
Instance Attribute Summary collapse
-
#data ⇒ Object
Returns the value of attribute data.
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
-
#initialize(*args) ⇒ Thread
constructor
A new instance of Thread.
Constructor Details
#initialize(*args) ⇒ Thread
Returns a new instance of Thread.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/knj/thread.rb', line 5 def initialize(*args) @data = {} raise "No block was given." if !block_given? super(*args) do begin yield(*args) rescue SystemExit exit rescue Exception => e print Knj::Errors.error_str(e) end end end |
Instance Attribute Details
#data ⇒ Object
Returns the value of attribute data.
3 4 5 |
# File 'lib/knj/thread.rb', line 3 def data @data end |