Class: Tox::Nospam

Inherits:
Binary show all
Defined in:
lib/tox/nospam.rb

Overview

Nospam primitive.

Instance Attribute Summary

Attributes inherited from Binary

#value

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Binary

#==, hex_re, #hex_value=, #inspect, #to_s

Constructor Details

#initialize(value) ⇒ Nospam

Returns a new instance of Nospam.



12
13
14
15
# File 'lib/tox/nospam.rb', line 12

def initialize(value)
  return @value = [value].pack('L').reverse.freeze if value.is_a? Integer
  super
end

Class Method Details

.bytesizeObject



8
9
10
# File 'lib/tox/nospam.rb', line 8

def self.bytesize
  4
end

Instance Method Details

#to_iObject



17
18
19
# File 'lib/tox/nospam.rb', line 17

def to_i
  @to_i ||= value.reverse.unpack('L').first
end