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

Add a variable_name method Increment and Decrement tags objects #1609

Merged
merged 1 commit into from
Aug 31, 2022

Conversation

dylanahsmith
Copy link
Contributor

In order to expose this state when using the parse tree, without having to resort to internal coupling like reading instance variables.

In order to expose this state when using the parse tree.
end

def render_to_output_buffer(context, output)
value = context.environments.first[@variable] ||= 0
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The assignment part of ||= 0 is unnecessary, since it is assigned again after decrementing.

end

def render_to_output_buffer(context, output)
value = context.environments.first[@variable] ||= 0
counter_environment = context.environments.first
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm both highlighting the fact that this environment is treated specially in this way and reducing the redundant methods calls to use this value twice

@ianks
Copy link
Contributor

ianks commented Aug 30, 2022

cc: @Maaarcocr

@dylanahsmith dylanahsmith merged commit 3a736da into master Aug 31, 2022
@dylanahsmith dylanahsmith deleted the expose-increment-var-name branch August 31, 2022 13:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants