2 Replies - 1812 Views - Last Post: 24 January 2016 - 07:01 PM Rate Topic: -----

#1 Zukurah  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 24-January 16

wrong number of arguments(2 for 1)

Posted 24 January 2016 - 06:50 PM

 puts "enter paragraph"
asdf = gets.chomp
puts "words to redact"
redact = gets.chomp
obscure = redact.split
words = asdf.split
words.each{ |word|
if word.include?(/#{obscure}/, "REDACTED")
else
    puts "#{word}"
end
}

Hey guys, just having some issues with the following code, and hoping i could get a little help with it.
essentially i want it to take a paragraph of text, then filter out any words within a string entered by the user.
im getting an error "wrong number of arguments(2 for 1)"

Is This A Good Question/Topic? 0
  • +

Replies To: wrong number of arguments(2 for 1)

#2 andrewsw  Icon User is online

  • the case is sol-ved
  • member icon

Reputation: 6378
  • View blog
  • Posts: 25,769
  • Joined: 12-December 12

Re: wrong number of arguments(2 for 1)

Posted 24 January 2016 - 07:01 PM

What line gives the error?

Note that this "issue with some beginner code requesting help please" is not a title, it gives no indication of what your question is about. I have changed it on this occasion.
Was This Post Helpful? 0
  • +
  • -

#3 xclite  Icon User is offline

  • I wrote you an code
  • member icon


Reputation: 1237
  • View blog
  • Posts: 4,029
  • Joined: 12-May 09

Re: wrong number of arguments(2 for 1)

Posted 24 January 2016 - 07:01 PM

View PostZukurah, on 24 January 2016 - 08:50 PM, said:

if word.include?(/#{obscure}/, "REDACTED")


Include doesn't take two arguments. How do you expect this line to work?
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1