Le 6 déc. 2009 à 02:09, Alex Ross a écrit :
Hey Alain,
I modified you command as follows:
#!/usr/bin/env ruby
require "#{ENV['TM_SUPPORT_PATH']}/lib/exit_codes" require "#{ENV['TM_BUNDLE_SUPPORT']}/lib/config_helper.rb"
symbols = Config.load['symbols'] word = STDIN.read
if symbols.has_key? word and not ENV['TM_SCOPE'].match(/math/) print "\$#{symbols[word]}$0\$" else TextMate.exit_discard end
If you have any questions about the semantics feel free to ask.
Hi Alex,
I need to take time to read some books about Ruby, Regex and perhaps Ruby Object Oriented Programming. I learned programming with Pascal in the late '80s and it's not easy to write some lines of code without a good knowledge of the tools.
About the semantics
In the code about numprint, you use "puts" instead of "print". Why?
My book gives "puts" equivalent to $stdout.puts(obj,..) and "print" prints each object in turn to $stdout.
And why do you use "unless" in the code for numprint and not here ?
Best Regards
Alain Matthes