Is the challenge poses bad practice without argument?

Below is a small screenshot from RubyMine 3.1. I'm just starting to learn Ruby. The code here is from the CENTER-First MVP MVP code generator at atomicobject.com .

I am using this project with a book to learn Ruby. The documentation for putsshows that it expects at least one parameter. However, this code looks โ€œsomewhat legitimateโ€ for two reasons:

However, is this a bad practice for this (hence the RubyMine warning)? The code I'm looking at is from 2006. I run it with Ruby 1.9.2, if that matters.

enter image description here

+3
source share
2 answers

This is great because it putsprovides a default value for the first parameter:

def puts(obj='', *arg)

As for RubyMine, it shows no errors for me. Could it be that you define a method putssomewhere else in your code? You can cmd+ click on it to go to the definition.

In any case, if you can reproduce the problem in a new new project, you can freely send an error report to JetBrains.

+3
source

, , , , , puts .

, , -doc.

+1

Source: https://habr.com/ru/post/1792541/


All Articles