Sha256: 4f4865de48dd48b8e22a7fbf40ebcbebca30ea544bd0bf23d01e397f6d56fef2
Contents?: true
Size: 707 Bytes
Versions: 9
Compression:
Stored size: 707 Bytes
Contents
require 'inline' module Merb module Global module DateProviders class Fork include Merb::Global::DateProviders::Base def localize(lang, date, format) pipe_rd, pipe_wr = IO.pipe pid = fork do pipe_rd.close setlocale(lang.to_s) pipe_wr.write(date.strftime(format)) pipe_wr.flush end pipe_wr.close Process.wait(pid) pipe_rd.read end inline do |builder| builder.include '<locale.h>' builder.c <<C void set_locale(const char *locale) { setlocale(LC_ALL, locale); } C end private :set_locale end end end end
Version data entries
9 entries across 9 versions & 2 rubygems