Issues with between

I am using the following ruby code but getting an exception about "ruby exception undefined method between? for nil:Nilclass"?

event.set("[weekInMonth]", 2) if event.get("[tempDay]").between?(8, 15)

What should I change this to? I am trying to use this for multiple things.

That suggests that some events do not have a tempDay field.