Sha256: 4d494c82ea0e5fd7c03579bcc44d205f65728242a0f2c2d44c981beb05a35412

Contents?: true

Size: 191 Bytes

Versions: 37

Compression:

Stored size: 191 Bytes

Contents

class Fixnum
  def clamp(low, high)
    raise "Low (#{low}) must be lower than high (#{high})" unless low < high
    return low if self < low
    return high if self > high
    self
  end
end

Version data entries

37 entries across 37 versions & 1 rubygems

Version Path
roqua-support-0.1.14 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.13 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.12 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.11 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.10 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.9 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.8 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.7 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.6 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.5 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.4 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.3 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.2.2 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.2.1 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.2 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.1 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.0 lib/roqua/core_ext/fixnum/clamp.rb