I am in the ruby console, and I am trying to invoke a method and I am not getting the syntax right.
Here is the structure of the file:
module App
module Tools
module Pollers
class Kpi
attr_reader :start_time,:stop_time
def initialize(start_time,stop_time)
@start_time = start_time
@stop_time = stop_time
end
.....
and I am trying to invoke this in the console like this:
?> kpi = App::Tools::Pollers::Kpi.initialize(start,end_date)
SyntaxError: compile error
(irb):17: syntax error, unexpected tCONSTANT, expecting kDO or '{' or '('
Would someone be able to point me to the right syntax for invoking the initialize ?
Thanks!
Judging by the error message, the problem is elsewhere, but you’ll probably want
Kpi.new, notKpi.initialize.Well, apparently it’s not elsewhere 🙂