Class: Kibuvits_krl171bt4_keyboard
- Inherits:
-
Object
- Object
- Kibuvits_krl171bt4_keyboard
- Includes:
- Singleton
- Defined in:
- lib/kibuvits_ruby_library_krl171bt4_.rb
Overview
Class Method Summary collapse
-
.ob_thread_gets_t1(ht_str2func) ⇒ Object
ob_thread_gets_t1.
Instance Method Summary collapse
-
#initialize ⇒ Kibuvits_krl171bt4_keyboard
constructor
A new instance of Kibuvits_krl171bt4_keyboard.
-
#ob_thread_gets_t1(ht_str2func) ⇒ Object
ht_str2func keys are strings and values are Ruby lambda functions.
Constructor Details
#initialize ⇒ Kibuvits_krl171bt4_keyboard
Returns a new instance of Kibuvits_krl171bt4_keyboard.
8544 8545 8546 8547 8548 8549 8550 8551 8552 8553 8554 |
# File 'lib/kibuvits_ruby_library_krl171bt4_.rb', line 8544 def initialize =begin raise(new.Exception("This class is totally flawed, becuase the "+ "gets uses stdin, which is tied to the main thread and "+ "as long as there's no way to get clean keyboard presses "+ "without the whole stdin stuff (the stdin is global by nature, "+ "with all the classicla glory of globals) then threads can not "+ "capture keyboard events independent of eachother."+ "\nGUID=='21d4b423-30a2-4143-812e-c13290a118e7')\n\n")) =end end |
Class Method Details
.ob_thread_gets_t1(ht_str2func) ⇒ Object
ob_thread_gets_t1
8595 8596 8597 8598 |
# File 'lib/kibuvits_ruby_library_krl171bt4_.rb', line 8595 def Kibuvits_krl171bt4_keyboard.ob_thread_gets_t1(ht_str2func) ob_thread=Kibuvits_krl171bt4_keyboard.instance.ob_thread_gets_t1(ht_str2func) return ob_thread end |
Instance Method Details
#ob_thread_gets_t1(ht_str2func) ⇒ Object
ht_str2func keys are strings and values are Ruby lambda functions.
Whenever a string that is a key of the ht_str2func is entered during the running of the thread, the function that is associated with the key, is run.
Returns a dormant thred that can be started by using Thread.run
WARNING: the current version blocks all file access and console feedback
8567 8568 8569 8570 8571 8572 8573 8574 8575 8576 8577 8578 8579 8580 8581 8582 8583 8584 8585 8586 8587 8588 8589 8590 8591 8592 8593 |
# File 'lib/kibuvits_ruby_library_krl171bt4_.rb', line 8567 def ob_thread_gets_t1(ht_str2func) if KIBUVITS_krl171bt4_b_DEBUG bn=binding() kibuvits_krl171bt4_typecheck bn, Hash, ht_str2func ht_str2func.each_pair do |x_key,x_value| bn_1=binding() kibuvits_krl171bt4_typecheck bn_1, String, x_key kibuvits_krl171bt4_typecheck bn_1, Proc, x_value end # loop end # if ob_thread=Thread.new do s_cmd=nil ob_func=nil rgx_1=/[\n]/ loop do $kibuvits_krl171bt4_lc_mx_streamaccess.synchronize do s_cmd=STDIN.gets end # synchronize s_cmd.gsub!(rgx_1,$kibuvits_krl171bt4_lc_emptystring) if ht_str2func.has_key? s_cmd ob_func=ht_str2func[s_cmd] ob_func.call end # if end # loop end # thread return ob_thread end |