mirror of
https://github.com/haml/haml.git
synced 2022-11-09 12:33:31 -05:00
Remove restrict - dead code
This commit is contained in:
parent
aa30b18af1
commit
dff6b50983
2 changed files with 0 additions and 18 deletions
|
@ -106,17 +106,6 @@ module Haml
|
|||
end
|
||||
end
|
||||
|
||||
# Restricts a number to falling within a given range.
|
||||
# Returns the number if it falls within the range,
|
||||
# or the closest value in the range if it doesn't.
|
||||
#
|
||||
# @param value [Numeric]
|
||||
# @param range [Range<Numeric>]
|
||||
# @return [Numeric]
|
||||
def restrict(value, range)
|
||||
[[value, range.first].max, range.last].min
|
||||
end
|
||||
|
||||
# Substitutes a sub-array of one array with another sub-array.
|
||||
#
|
||||
# @param ary [Array] The array in which to make the substitution
|
||||
|
|
|
@ -65,13 +65,6 @@ class UtilTest < MiniTest::Unit::TestCase
|
|||
powerset([1, 2, 3]))
|
||||
end
|
||||
|
||||
def test_restrict
|
||||
assert_equal(0.5, restrict(0.5, 0..1))
|
||||
assert_equal(1, restrict(2, 0..1))
|
||||
assert_equal(1.3, restrict(2, 0..1.3))
|
||||
assert_equal(0, restrict(-1, 0..1))
|
||||
end
|
||||
|
||||
def test_substitute
|
||||
assert_equal(["foo", "bar", "baz", 3, 4],
|
||||
substitute([1, 2, 3, 4], [1, 2], ["foo", "bar", "baz"]))
|
||||
|
|
Loading…
Add table
Reference in a new issue