C
Clement Ow
I have built my own ruby library where it contains my specific commands
and methods that I need to perform certain actions and my main script.
In my ruby library I have something like:
class Test
def toDDMMYYYY(sep)
strftime("%d#{sep}%m#{sep}%Y")
end
end
And in my main script I have something like:
require 'PersonalRubyLib.rb'
class MainLogic
def show_date
d = Date.today
d.Test.toDDMMYYYY("-")
end
end
But apparently it shows an error:
undefined method `toDDMMYYYY' for #<Date: 4909313
,2299161> (NoMethodError)
Did do wrongly in calling the class methods, maybe I am confused with
the syntax of calling class methods? Much help is appreciated, thanks!
and methods that I need to perform certain actions and my main script.
In my ruby library I have something like:
class Test
def toDDMMYYYY(sep)
strftime("%d#{sep}%m#{sep}%Y")
end
end
And in my main script I have something like:
require 'PersonalRubyLib.rb'
class MainLogic
def show_date
d = Date.today
d.Test.toDDMMYYYY("-")
end
end
But apparently it shows an error:
undefined method `toDDMMYYYY' for #<Date: 4909313
,2299161> (NoMethodError)
Did do wrongly in calling the class methods, maybe I am confused with
the syntax of calling class methods? Much help is appreciated, thanks!