Class: Integer

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

Numeric Additions

Kyanite definitions

Numeric Integer Float

Kyanite tests and examples

TestKyaniteNumeric

Usage

require 'kyanite/numeric'

Instance Method Summary (collapse)

Instance Method Details

- (self) dup

self, you can not dup Integers

Returns:

  • (self)


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

def dup;                            self;            end

- (self) to_integer

self, complements String#to_integer.

Returns:

  • (self)


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

def to_integer;                     self;            end

- (self) to_integer_optional

self, complements String#to_integer_optional.

Returns:

  • (self)


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

def to_integer_optional;            self;            end

- (Time) to_time

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