Class: Fields::DataField

Inherits:
LabeledField show all
Defined in:
lib/hammer_cli/output/fields.rb

Direct Known Subclasses

Collection, Date, Id, Joint, KeyValue, List

Instance Attribute Summary collapse

Attributes inherited from LabeledField

#label

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ DataField

Returns a new instance of DataField.



28
29
30
31
# File 'lib/hammer_cli/output/fields.rb', line 28

def initialize(options={})
  @path = options[:path] || []
  super(options)
end

Instance Attribute Details

#pathObject (readonly)

Returns the value of attribute path.



26
27
28
# File 'lib/hammer_cli/output/fields.rb', line 26

def path
  @path
end

Instance Method Details

#get_value(data) ⇒ Object



33
34
35
# File 'lib/hammer_cli/output/fields.rb', line 33

def get_value(data)
  follow_path(data, path || [])
end