-
Notifications
You must be signed in to change notification settings - Fork 110
Convert ERB code into Ruby before type-checking #1836
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
base: master
Are you sure you want to change the base?
Convert ERB code into Ruby before type-checking #1836
Conversation
Use class << self for private methods
fd6e3c4 to
63cbedc
Compare
|
Good idea, but I suggest making use of Additionally, ERB isn’t limited to Rails, let alone HTML.
|
|
@ParadoxV5 thanks for the review!
The ERB::Compiler looks great, I'm going to use it.
My fault, I'm used ERB only with Rails, I'm going to adjust the tests examples.
Regarding moving this to RBS, I will analyze the projects better to give an opinion. |
|
@ParadoxV5 I have not found a way to use ERB::Compiler for the proposal of this PR. Could you instruct me on how to use it, please? Alternatively, I found the Herb that almost provides the parser we need. Herb just doesn't provide a public API with Ruby code with semicolons, but I'm trying to make a contribution to doing that here. It's ok to use that? |
…ruby_before_type_checking
The documentation above expand/collapse section
That means, erb = ERB::Compiler.new nil
erb.put_cmd = erb.insert_cmd= "\n"
puts erb.compile('Got <%= process(obj) %>!').first
Assuming |
|
Thanks for the instructions @ParadoxV5! I might have misunderstood some part, but I still couldn't to handle the verbatim texts like |
ERB to Ruby code conversion is needed to type-check ERB.
Input:
Output: (replace HTML tags with whitespace)
refs: #1409