Class: Fields::Field
- Inherits:
-
Object
show all
- Defined in:
- lib/hammer_cli/output/fields.rb
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(options = {}) ⇒ Field
Returns a new instance of Field.
10
11
12
13
14
15
16
|
# File 'lib/hammer_cli/output/fields.rb', line 10
def initialize(options={})
@hide_blank = options[:hide_blank].nil? ? false : options[:hide_blank]
@hide_missing = options[:hide_missing].nil? ? true : options[:hide_missing]
@path = options[:path] || []
@label = options[:label]
@options = options
end
|
Instance Attribute Details
#label ⇒ Object
Returns the value of attribute label.
7
8
9
|
# File 'lib/hammer_cli/output/fields.rb', line 7
def label
@label
end
|
#path ⇒ Object
Returns the value of attribute path.
8
9
10
|
# File 'lib/hammer_cli/output/fields.rb', line 8
def path
@path
end
|
Instance Method Details
#display?(value) ⇒ Boolean
26
27
28
29
30
31
32
33
34
|
# File 'lib/hammer_cli/output/fields.rb', line 26
def display?(value)
if value.is_a?(HammerCLI::Output::DataMissing)
!hide_missing?
elsif value.nil?
!hide_blank?
else
true
end
end
|
#hide_blank? ⇒ Boolean
18
19
20
|
# File 'lib/hammer_cli/output/fields.rb', line 18
def hide_blank?
@hide_blank
end
|
#hide_missing? ⇒ Boolean
22
23
24
|
# File 'lib/hammer_cli/output/fields.rb', line 22
def hide_missing?
@hide_missing
end
|
#parameters ⇒ Object
36
37
38
|
# File 'lib/hammer_cli/output/fields.rb', line 36
def parameters
@options
end
|