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

Allow binding to via the kwarg in tokens #717

Closed
wants to merge 1 commit into from

Conversation

bradgessler
Copy link
Contributor

@bradgessler bradgessler commented May 13, 2024

This commit provides a shortcut for binding to a class keyword argument and passing it into tokens, like this:

def view_template
  red(class: "buzz")
end

def red(class:)
  div(class: tokens("fizz", class:))
end

Prior to this commit, I'd have to manually bind to the class keyword argument passed into tokens like this:

def red(class:)
  div(class: tokens("fizz", binding.local_variable_get(:class)))
end

@joeldrapper
Copy link
Collaborator

This is an awesome idea. I want to do something with it, but I don’t think tokens is the right place for this as it is currently implemented. Keyword arguments on the tokens method are for conditional tokens, where the key is the condition and the value is the token set.

@joeldrapper joeldrapper deleted the keyword-class-binding branch May 15, 2024 16:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

2 participants