Class: HammerCLI::Output::Formatters::KeyValueFormatter

Inherits:
FieldFormatter
  • Object
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(params, field_params = {}) ⇒ Object



141
142
143
144
145
146
147
148
149
# File 'lib/hammer_cli/output/formatters.rb', line 141

def format(params, field_params={})
  if params.is_a? Hash
    name = params[:name] || params["name"]
    value = params[:value] || params["value"]
    "#{name} => #{value}"
  else
    ""
  end
end

#required_featuresObject



135
136
137
138
139
# File 'lib/hammer_cli/output/formatters.rb', line 135

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

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