Class: ActiveSupport::TimeWithZone
- Inherits:
-
Object
- Object
- ActiveSupport::TimeWithZone
- Includes:
- FormatTime
- Defined in:
- lib/formatted_times/active_support_ext.rb
Constant Summary
Constants included from FormatTime
FormatTime::FORMATTING_OPTIONS
Instance Method Summary collapse
Methods included from FormatTime
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(sym, *args, &block) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/formatted_times/active_support_ext.rb', line 6 def method_missing(sym, *args, &block) method_name = sym.to_s if method_name.starts_with? 'frmt_' if args.length.in?([1, 2]) and args[0].is_a?(String) strf_time_string = get_strftime_string(method_name, args[0], args[1]) else strf_time_string = get_strftime_string(method_name) end return self.strftime(strf_time_string) end wrap_with_time_zone time.__send__(sym, *args, &block) rescue NoMethodError => e raise e, e..sub(time.inspect, self.inspect), e.backtrace end |