class Fields::Field
Attributes
deprecated[RW]
label[RW]
parent[RW]
path[R]
replaced_by[RW]
sets[W]
Public Class Methods
new(options={})
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 9 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] @sets = options[:sets] @replaced_by = options[:replaced_by] @deprecated = (options[:deprecated].nil?) ? !@replaced_by.nil? : options[:deprecated] @options = options end
Public Instance Methods
display?(value)
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 45 def display?(value) if value.is_a?(HammerCLI::Output::DataMissing) !hide_missing? elsif value.nil? !hide_blank? else true end end
full_label()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 36 def full_label return @label.to_s if @parent.nil? "#{@parent.full_label}/#{@label}" end
hide_blank?()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 28 def hide_blank? @hide_blank end
hide_missing?()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 32 def hide_missing? @hide_missing end
id()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 20 def id @options[:id] || @options[:key] || @label end
match_id?(field_id)
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 24 def match_id?(field_id) @options[:id] == field_id || @options[:key] == field_id || @label == _(field_id) end
parameters()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 55 def parameters @options end
sets()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 41 def sets @sets || inherited_sets || default_sets end
Protected Instance Methods
default_sets()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 66 def default_sets %w[DEFAULT ALL] end
inherited_sets()
click to toggle source
# File lib/hammer_cli/output/fields.rb, line 61 def inherited_sets return nil if @parent.nil? @parent.sets end