Class: Merb::Global::NumericProviders::Fork
- Inherits:
-
Object
- Object
- Merb::Global::NumericProviders::Fork
- Includes:
- DateProviders::Base
- Defined in:
- lib/merb_global/numeric_providers/fork.rb
Instance Method Summary collapse
Instance Method Details
#localize(lang, number) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/merb_global/numeric_providers/fork.rb', line 9 def localize(lang, number) pipe_rd, pipe_wr = IO.pipe # setlocale have no guarantee of being thread-safe so for safty # we fork the process. pid = fork do pipe_rd.close setlocale(lang.to_s) pipe_wr.write(number) pipe_wr.flush end pipe_wr.close Process.wait(pid) pipe_rd.read end |