Class: HammerCLI::Output::Formatters::DateFormatter

Inherits:
FieldFormatter show all
Defined in:
lib/hammer_cli/output/formatters.rb

Instance Method Summary collapse

Methods inherited from FieldFormatter

inherited, #match?, #tags

Instance Method Details

#format(string_date, _ = {}) ⇒ Object



100
101
102
103
104
105
# File 'lib/hammer_cli/output/formatters.rb', line 100

def format(string_date, _={})
  t = DateTime.parse(string_date.to_s)
  t.strftime("%Y/%m/%d %H:%M:%S")
rescue ArgumentError
  ""
end

#required_featuresObject



94
95
96
97
98
# File 'lib/hammer_cli/output/formatters.rb', line 94

def required_features
  return %i[serialized] if tags.empty?

  tags.map { |t| HammerCLI::Output::Utils.tag_to_feature(t) }
end