Hi!
I'm trying out Ruby koans and found some tests using this _n_
, never seen it before what is it and how do I use it?
Example:
def test_objects_have_methods
fido = Dog.new
assert fido.methods.size > _n_
end
// John
Hi!
I'm trying out Ruby koans and found some tests using this _n_
, never seen it before what is it and how do I use it?
Example:
def test_objects_have_methods
fido = Dog.new
assert fido.methods.size > _n_
end
// John
It's just a variable. Variable names in ruby can use underscores (even at fist and last positions). Try ctrl-clicking it in your IDE and you'll probably see its declaration.
Are you sure that _n_
isn't one of the "fill in the blanks" parts?
Found it:
# Numeric replacement value.
def _n_(value=999999, value19=:mu)
if RUBY_VERSION < "1.9"
value
else
(value19 == :mu) ? value : value19
end
end