Class: Fields::SingleReference
Instance Method Summary
collapse
Methods inherited from Reference
#initialize
Instance Method Details
#display?(value) ⇒ Boolean
40
41
42
43
44
45
|
# File 'lib/hammer_cli_foreman/output/fields.rb', line 40
def display?(value)
id_key = @options[:id_key]
display_key = @options[:display_field_key]
(value[display_key.to_sym] || value[display_key]) && (value[id_key.to_sym] || value[id_key])
end
|
#initialize_options ⇒ Object
31
32
33
34
35
36
37
38
|
# File 'lib/hammer_cli_foreman/output/fields.rb', line 31
def initialize_options
key = @options[:key]
display_field = @options[:display_field] || 'name'
@options[:id_key] ||= "#{key}_id"
@options[:display_field_key] ||= "#{key}_#{display_field}"
super
end
|