Class: ParameterSubstitution::Formatters::InTimezone
- Inherits:
-
DateTimeFormat
- Object
- Base
- DateTimeFormat
- ParameterSubstitution::Formatters::InTimezone
- Defined in:
- lib/parameter_substitution/formatters/in_timezone.rb
Constant Summary
Constants inherited from DateTimeFormat
DateTimeFormat::MINIMUM_INTEGER_TIME
Class Method Summary collapse
Instance Method Summary collapse
- #format(value) ⇒ Object
-
#initialize(destination_timezone) ⇒ InTimezone
constructor
A new instance of InTimezone.
Methods inherited from DateTimeFormat
from_custom_time, from_parse, from_unix_time_ms, from_unix_time_sec, from_yyyymmddhhmmssss, parse_to_time
Methods inherited from Base
encoding, format, key, parse_duration
Constructor Details
#initialize(destination_timezone) ⇒ InTimezone
Returns a new instance of InTimezone.
12 13 14 |
# File 'lib/parameter_substitution/formatters/in_timezone.rb', line 12 def initialize(destination_timezone) @destination_timezone = destination_timezone end |
Class Method Details
.description ⇒ Object
4 5 6 |
# File 'lib/parameter_substitution/formatters/in_timezone.rb', line 4 def self.description "Converts a date time to the specified time zone." end |
.has_parameters? ⇒ Boolean
8 9 10 |
# File 'lib/parameter_substitution/formatters/in_timezone.rb', line 8 def self.has_parameters? true end |
Instance Method Details
#format(value) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/parameter_substitution/formatters/in_timezone.rb', line 16 def format(value) if (value_as_time = self.class.parse_to_time(value)) value_as_time.in_time_zone(@destination_timezone).strftime('%Y-%m-%d %H:%M:%S') else value end end |