Sha256: 3a76aee707ff2200baccc4e0b3aa7676e5267a6b82cefa154d223a5a5864d324
Contents?: true
Size: 574 Bytes
Versions: 2
Compression:
Stored size: 574 Bytes
Contents
require 'yaml' module PetiteLettre def self.call(command,message) IO.popen(command,mode='r+') do |io| io.write(YAML::dump(message)) io.close_write result = YAML::load(io.read) raise result[:error][:message] if result.is_a?(Hash) && result[:error] result end end def self.receive(input=$stdin,output=$stdout) message = YAML::load(input.read) result = nil begin result = yield message rescue => e result = { :error => { :message => e.message } } end output.write(YAML::dump(result)) end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
thbar-petite-lettre-1.0.0 | lib/petite_lettre.rb |
petite-lettre-1.0.0 | lib/petite_lettre.rb |