Execute SNUSP/Ruby: Difference between revisions
Content added Content deleted
m (moved RCSNUSP/Ruby to Execute SNUSP/Ruby) |
m (Fixed syntax highlighting.) |
||
Line 1: | Line 1: | ||
{{implementation|SNUSP}}{{collection|RCSNUSP}} |
{{implementation|SNUSP}}{{collection|RCSNUSP}} |
||
These [[Ruby]] implementations of SNUSP profiles are partially derived from [[RCSNUSP/Tcl]]. |
These [[Ruby]] implementations of SNUSP profiles are partially derived from [[RCSNUSP/Tcl]]. |
||
== |
===Core SNUSP=== |
||
< |
<syntaxhighlight lang="ruby">$stdout.sync = true |
||
$stdin.sync = true |
$stdin.sync = true |
||
Line 183: | Line 183: | ||
puts "done" |
puts "done" |
||
end</ |
end</syntaxhighlight> |
||
Output: |
Output: |
||
Line 193: | Line 193: | ||
done</pre> |
done</pre> |
||
== |
===Modular SNUSP=== |
||
< |
<syntaxhighlight lang="ruby">require 'rc_coresnusp.rb' |
||
class ModularSNUSP < CoreSNUSP |
class ModularSNUSP < CoreSNUSP |
||
Line 283: | Line 283: | ||
puts "done" |
puts "done" |
||
end</ |
end</syntaxhighlight> |
||
Output: |
Output: |
||
<pre>$ ruby rc_modularsnusp.rb |
<pre>$ ruby rc_modularsnusp.rb |
||
Line 296: | Line 296: | ||
done</pre> |
done</pre> |
||
== |
===Bloated SNUSP=== |
||
User input is still line-oriented -- must press Enter before Ruby sees input. |
User input is still line-oriented -- must press Enter before Ruby sees input. |
||
< |
<syntaxhighlight lang="ruby">require 'rc_modularsnusp.rb' |
||
# here, need input to be non-blocking, so other "threads" can keep working. |
# here, need input to be non-blocking, so other "threads" can keep working. |
||
Line 486: | Line 486: | ||
puts "done" |
puts "done" |
||
end</ |
end</syntaxhighlight> |
||
Output: |
Output: |