Module: Chan
- Defined in:
- lib/xchan.rb,
lib/xchan/version.rb,
lib/xchan/tempfile.rb
Defined Under Namespace
Classes: Bytes, Counter, UNIXSocket
Constant Summary collapse
- WaitReadable =
Class.new(IO::EAGAINWaitReadable)
- WaitWritable =
Class.new(IO::EAGAINWaitWritable)
- WaitLockable =
Class.new(Errno::EWOULDBLOCK)
- Pure =
Coerces an object to a string for a channel communicating in raw strings (in other words: without serialization)
Class.new do def self.dump(str) = str.to_s def self.load(str) = str.to_s end
- VERSION =
"0.18.0"
Class Method Summary collapse
-
.temporary_file(basename, tmpdir: Dir.tmpdir) ⇒ Chan::Tempfile
Returns an unlinked Chan::Tempfile object that can be read from, and written to by the process that created it, inclusive of its child processes, but not of processes other than that.
-
.serializers ⇒ Hash<Symbol, Proc>
Returns the default serializers.
Class Method Details
.temporary_file(basename, tmpdir: Dir.tmpdir) ⇒ Chan::Tempfile
Returns an unlinked Chan::Tempfile object that can be read from, and written to by the process that created it, inclusive of its child processes, but not of processes other than that.
39 40 41 |
# File 'lib/xchan.rb', line 39 def self.temporary_file(basename, tmpdir: Dir.tmpdir) Chan::Tempfile.new(basename, tmpdir, perm: 0).tap(&:unlink) end |
.serializers ⇒ Hash<Symbol, Proc>
Returns the default serializers
46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/xchan.rb', line 46 def self.serializers { pure: lambda { Pure }, marshal: lambda { Marshal }, json: lambda { require "json" unless defined?(JSON) JSON }, yaml: lambda { require "yaml" unless defined?(YAML) YAML } } end |