What are these rubies?

I tried Ruby koans and found several tests using this one _n_, never seen it before, what is it and how to use it?

Example:

def test_objects_have_methods
           fido = Dog.new
           assert fido.methods.size > _n_
end

//John

+5
source share
3 answers

Found:

 # Numeric replacement value.
    def _n_(value=999999, value19=:mu)
      if RUBY_VERSION < "1.9"
        value
      else
        (value19 == :mu) ? value : value19
      end
    end
+5
source

This is just a variable. Variable names in ruby ​​can use underscores (even in fists and in last positions). Try ctrl-clicking on it in your IDE and you are likely to see its declaration.

+2
source

Are you sure it is _n_not part of the "fill in the blanks"?

+2
source

All Articles