Can I use Ruby to call the timeline from the SketchUp shadow setting function?

I want to use the variable of year, month, day, hour, minute, second and so on in module SW respectively for operation. I have tried for many times, but there are always mistakes. Could you please help me write an instance?