Sha256: ac87a9ff2a3fa1a04c7c2cce923e28b221cddfa25285ea5209bd7221ff65a16b
Contents?: true
Size: 970 Bytes
Versions: 3
Compression:
Stored size: 970 Bytes
Contents
require 'active_support/core_ext' require 'active_support/core_ext/object/to_json' module JobDispatch # Identity encapsulates a ZeroMQ socket identity, which is a string of binary characters, typically # containing nulls or non-utf8 compatible characters in ASCII-8BIT encoding. class Identity include Comparable attr_reader :identity def initialize(identity) @identity = identity.to_sym end def to_s @identity.to_s end def to_str @identity.to_str end def to_hex @identity.to_s.bytes.map { |x| '%02x' % x }.join end def as_json(options={}) to_hex.as_json(options) end def to_sym @identity end def hash @identity.hash end def ==(other) @identity == other.identity end def eql?(other) self.class == other.class && @identity == other.identity end def <=>(other) @identity <=> other.identity end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
job_dispatch-0.2.0 | lib/job_dispatch/identity.rb |
job_dispatch-0.1.0 | lib/job_dispatch/identity.rb |
job_dispatch-0.0.2 | lib/job_dispatch/identity.rb |