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.34 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.33 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.32 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.31 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.30 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.29 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.28 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.27 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.26 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.25 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.24 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.23 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.22 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.21 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.20 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.19 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.18 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.17 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.16 lib/roqua/core_ext/fixnum/clamp.rb
roqua-support-0.1.15 lib/roqua/core_ext/fixnum/clamp.rb