Cannot initialize Tap::Task extending class

1 view
Skip to first unread message

grosser.michael

unread,
Dec 14, 2008, 1:36:14 PM12/14/08
to Tap Forum
# ::manifest sdsdds
class Xyz < Tap::Task
def initialize
super
end

def process
puts 'working...'
end
end

tap run xyz
wrong number of arguments (3 for 0)




Simon Chiang

unread,
Dec 14, 2008, 7:29:24 PM12/14/08
to ruby-...@googlegroups.com
Ah, took me a second to see what's up.  Tap::Task requires arguments for initialization.

# ::manifest sdsdds
class Xyz < Tap::Task
 def initialize(*args)   # arguments must be passed to super

   super
 end

 def process
   puts 'working...'
 end
end

Solves the problem for me.  This is not a tap-specific thing... whenever you override a method and call super you have to get it arguments somehow. 

  def m
    super
  end

Is like:

  def m()
    super()
  end

While:
 
  def m(*args)
    super
  end

Is like:

  def m(*args)
     super(*args)
  end

By the way... looking at this I thought of a flag you might find useful.  I don't think I documented it anywhere, but when you're running tap (or rap) and you want debugging, add '-d-' at the end of your command like:

  % tap run xyz -d-

That's what let me know the problem wasn't the arguments going to process but the arguments going to initialize.

Cheers,
- Simon

 
Reply all
Reply to author
Forward
0 new messages