Module: Fixnum::FixnumExtensions

Included in:
Fixnum
Defined in:
lib/ruckus/extensions/fixnum.rb

Instance Method Summary collapse

Instance Method Details

#cloneObject

you can’t clone a fixnum? Why?



19
# File 'lib/ruckus/extensions/fixnum.rb', line 19

def clone; self; end

#lower?Boolean

Returns:

  • (Boolean)


22
# File 'lib/ruckus/extensions/fixnum.rb', line 22

def lower?; self >= 0x61 and self <= 0x7a; end

#printable?Boolean

Ridiculous that this isn’t in the library.

Returns:

  • (Boolean)


4
# File 'lib/ruckus/extensions/fixnum.rb', line 4

def printable?; self >= 0x20 and self <= 0x7e; end

#stepwith(limit, stepv, &block) ⇒ Object

Like Numeric#Step, but yields the length of each span along with the offset. Useful for stepping through data in increments: 0.stepwith(buffer.size, 4096) {|off,len| pp buffer} The “len” parameter accounts for the inevitable short final block.



10
11
12
13
14
15
16
# File 'lib/ruckus/extensions/fixnum.rb', line 10

def stepwith(limit, stepv, &block)
    # XXX not used
    step(limit, stepv) do |i|
        remt = limit - i
        yield i, remt.cap(stepv)
    end
end

#upper?Boolean

Returns:

  • (Boolean)


21
# File 'lib/ruckus/extensions/fixnum.rb', line 21

def upper?; self >= 0x41 and self <= 0x5a; end