module VV::IntegerMethods
Public Class Methods
included(base)
click to toggle source
# File lib/vv/integer_methods.rb, line 4 def self.included(base) base.extend(ClassMethods) end
Public Instance Methods
bits()
click to toggle source
# File lib/vv/integer_methods.rb, line 24 def bits bits_per_byte = 8 self.ceil_divide bits_per_byte end
ceil_divide(divisor)
click to toggle source
# File lib/vv/integer_methods.rb, line 20 def ceil_divide divisor self % divisor > 0 ? ( self / divisor ) + 1 : self / divisor end
characters(character, fail_on_negative: false)
click to toggle source
# File lib/vv/integer_methods.rb, line 73 def characters character, fail_on_negative: false message = "Expected single character, not #{character}." fail ArgumentError, message if character.length > 1 message = "Expected non-negative integer, not `#{self}`." fail message if self < 0 and fail_on_negative ( self > 0 ) ? ( character * self ) : String.empty_string end
dashes()
click to toggle source
# File lib/vv/integer_methods.rb, line 69 def dashes characters String.dash end
exbibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 59 def exbibytes self.pebibytes * 1024 end
gibibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 41 def gibibytes self.mebibytes * 1024 end
kibibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 29 def kibibytes self * 1024 end
mebibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 35 def mebibytes self.kibibytes * 1024 end
pebibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 53 def pebibytes self.tebibytes * 1024 end
spaces()
click to toggle source
# File lib/vv/integer_methods.rb, line 65 def spaces characters String.space end
tebibytes()
click to toggle source
# File lib/vv/integer_methods.rb, line 47 def tebibytes self.gibibytes * 1024 end
to_i!()
click to toggle source
# File lib/vv/integer_methods.rb, line 83 def to_i! self end
vv_json()
click to toggle source
# File lib/vv/integer_methods.rb, line 16 def vv_json self.to_json end