Class: Integer

Inherits:
Object show all
Defined in:
lib/kyanite/numeric/integer.rb,
lib/kyanite/string/cast.rb

Overview

Numeric Additions

Kyanite definitions

Numeric Integer Float

Kyanite tests and examples

TestKyaniteNumeric

Usage

require ‘kyanite/numeric’

Instance Method Summary collapse

Instance Method Details

#dupself

self, you can not dup Integers

Returns:

  • (self)


22
# File 'lib/kyanite/numeric/integer.rb', line 22

def dup;                            self;            end

#to_integerself

self, complements String#to_integer.

Returns:

  • (self)


133
# File 'lib/kyanite/string/cast.rb', line 133

def to_integer;                     self;            end

#to_integer_optionalself

self, complements String#to_integer_optional.

Returns:

  • (self)


138
# File 'lib/kyanite/string/cast.rb', line 138

def to_integer_optional;            self;            end

#to_timeTime

Converts a number of seconds-since-1970 in a Time object

Returns:

  • (Time)


14
15
16
17
# File 'lib/kyanite/numeric/integer.rb', line 14

def to_time
  return nil if self > 2099999999     # geht leider nur bis ins Jahr 2036 
  ::Time.at(self)                     # ohne die Doppelpunkte sucht Ruby die Methode at in ::Time und wirft einen Error
end