Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module TimeExtender
- using TimeFormatter
- puts Time.now.format_to_my_datetime("-05:00")
- # in Rails, time is often translated into an ActiveSupport::TimeWithZone object
- refine ActiveSupport::TimeWithZone do
- # iputs Time.now.format_to_my_datetime("-05:00")
- def method_missing(method, *args)
- # Time cant respond_to? refinements no matter where I try a `using` call because
- # Kernel methods for reflection are not in Ruby yet
- # http://stackoverflow.com/questions/15263261/why-does-send-fail-with-ruby-2-0-refinement
- #if Time.respond_to?(method.to_sym)
- self.to_time.send(method.to_sym, args.first)
- #end
- end
- end
- puts Time.now.format_to_my_datetime("-05:00")
- end
Advertisement
Add Comment
Please, Sign In to add comment