# File lib/hammer_cli_foreman/output/formatters.rb, line 10 def format(resource, field_params={}) return "" if resource.nil? key = field_params[:key] id_key = "#{key}_id" name_key = "#{key}_name" name = resource[name_key.to_sym] || resource[name_key] id = resource[id_key.to_sym] || resource[id_key] context = field_params[:context] || {} if context[:show_ids] "#{name} (id: #{id})" if id && name else "#{name}" if name end end
Generated with the Darkfish Rdoc Generator 2.