Class: Int

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/activefacts/api/numeric.rb

Overview

It’s not possible to subclass Integer, so instead we delegate to it.

Direct Known Subclasses

SignedInteger, UnsignedInteger

Instance Method Summary collapse

Constructor Details

#initialize(i = nil) ⇒ Int

:nodoc:



16
17
18
# File 'lib/activefacts/api/numeric.rb', line 16

def initialize(i = nil)               #:nodoc:
  __setobj__(Integer(i))
end

Instance Method Details

#==(o) ⇒ Object

:nodoc:



32
33
34
# File 'lib/activefacts/api/numeric.rb', line 32

def ==(o)                             #:nodoc:
  __getobj__.==(o)
end

#eql?(o) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


28
29
30
# File 'lib/activefacts/api/numeric.rb', line 28

def eql?(o)                           #:nodoc:
  self.class == o.class and __getobj__.eql?(Integer(o))
end

#hashObject

:nodoc:



24
25
26
# File 'lib/activefacts/api/numeric.rb', line 24

def hash                              #:nodoc:
  __getobj__.hash ^ self.class.hash
end

#inspectObject



36
37
38
# File 'lib/activefacts/api/numeric.rb', line 36

def inspect
  "#{self.class.basename}:#{__getobj__.inspect}"
end

#to_sObject

:nodoc:



20
21
22
# File 'lib/activefacts/api/numeric.rb', line 20

def to_s                              #:nodoc:
  __getobj__.to_s
end