Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #33259 - Don't store @context in field params #353

Merged
merged 1 commit into from Aug 17, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/hammer_cli/output/adapter/abstract.rb
Expand Up @@ -97,6 +97,12 @@ def sets_filter
@context[:fields] || ['DEFAULT']
end

def context_for_fields
{
show_ids: @context[:show_ids]
}
end

private

def filter_formatters(formatters_map)
Expand Down
2 changes: 1 addition & 1 deletion lib/hammer_cli/output/adapter/base.rb
Expand Up @@ -76,7 +76,7 @@ def render_label(field, width)
def render_value(field, data)
formatter = @formatters.formatter_for_type(field.class)
parameters = field.parameters
parameters[:context] = @context
parameters[:context] = context_for_fields
data = formatter.format(data, field.parameters) if formatter
data.to_s
end
Expand Down
2 changes: 1 addition & 1 deletion lib/hammer_cli/output/adapter/tree_structure.rb
Expand Up @@ -55,7 +55,7 @@ def render_field(field, data)
else
formatter = @formatters.formatter_for_type(field.class)
parameters = field.parameters
parameters[:context] = @context
parameters[:context] = context_for_fields
if formatter
data = formatter.format(data, field.parameters)
end
Expand Down