Slide 37
Slide 37 text
module TimeAttributeMethods
def time_reader(attr, from:)
include (Module.new do |mod|
define_method(attr) do |tz = UTC|
tz.at(public_send(from))
end
end)
end
end
time_reader :datapoint_at, from: :datapoint_ts
Datapoint.ancestors # => [Datapoint, #, Object, PP::ObjectMixin,
Kernel, BasicObject]