class Generic
@@router=''
@@digit=''
@@data=''
def initialize(str)
@str=str
end
#def seperate
# @str="434 <user;password>##ROUTER=BROKER_NAME##"
#puts @str.split()
def digit
@digit=@str[0,3]
puts "Digit Part: " +@digit
end
def data
@data=@str[/<[a-z]*;[a-z]*>/]
puts "Data Part: " +@data
end
def router
@router=@str[/##[A-Z]*=[A-Z]*_[A-Z]*##/]
puts "Router part: " +@router
end
end
class Sub < Generic
end
genericobj=Generic.new('434 <user;password>##ROUTER=BROKER_NAME##')
genericobj.data
genericobj.digit
genericobj.router
subobj=Sub.new
subobj.data
Here when I try to create a new subclass object I get the following error
"home/user/workspace/Parser/generic.rb:38:in `initialize': wrong number of arguments (0 for 1) (ArgumentError)
from /home/user/workspace/Parser/generic.rb:38:in `new'
from /home/user/workspace/Parser/generic.rb:38
Am not trying to use a constructor for the subclass but I still get this error. Please someone tell me where am going wrong
Thanks in Advance