Class: HammerCLI::Output::Formatters::FieldFormatter
- Inherits:
-
Object
- Object
- HammerCLI::Output::Formatters::FieldFormatter
show all
- Defined in:
- lib/hammer_cli/output/formatters.rb
Overview
Class Method Summary
collapse
Instance Method Summary
collapse
Class Method Details
.inherited(subclass) ⇒ Object
47
48
49
50
51
52
53
54
55
56
57
|
# File 'lib/hammer_cli/output/formatters.rb', line 47
def self.inherited(subclass)
subclass.define_singleton_method(:method_added) do |method_name|
if method_name == :tags
warn(
_('Method %{tags} for field formatters and output adapters is deprecated. Please use %{feat} or %{req_feat} instead.') % {
tags: 'tags', feat: 'features', req_feat: 'required_features'
}
)
end
end
end
|
Instance Method Details
43
44
45
|
# File 'lib/hammer_cli/output/formatters.rb', line 43
def format(data, field_params={})
data
end
|
#match?(features) ⇒ Boolean
39
40
41
|
# File 'lib/hammer_cli/output/formatters.rb', line 39
def match?(features)
required_features & features == required_features
end
|
#required_features ⇒ Object
33
34
35
36
37
|
# File 'lib/hammer_cli/output/formatters.rb', line 33
def required_features
return %i[] if tags.empty?
tags.map { |t| HammerCLI::Output::Utils.tag_to_feature(t) }
end
|
29
30
31
|
# File 'lib/hammer_cli/output/formatters.rb', line 29
def tags
%i[]
end
|