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

Methods called within the ERB template are not generated in the component output #53

Open
marcoroth opened this issue Jan 20, 2023 · 2 comments
Labels
enhancement New feature or request

Comments

@marcoroth
Copy link
Owner

marcoroth commented Jan 20, 2023

ERB Input:

<% if some_condition? %>
  <%= "Text" %>
<% end %>

Output:

class Component < Phlex::HTML
  def template
    if some_condition?
      text "Text"
    end
  end
end

Expected output:

class Component < Phlex::HTML
  def template
    if some_condition?
      text "Text"
    end
  end

  private 
  
  # TODO: Implement the `some_condition?` method
  def some_condition?
    super
  end
end
@joeldrapper
Copy link
Collaborator

This might be unnecessary since we’ll get a helpful NoMethodError anyway when calling method? anyway.

@marcoroth
Copy link
Owner Author

I thought it might be cool to indicate that there's still something missing.

But I updated the example to use super so that we still would get the helpful exception.

@marcoroth marcoroth changed the title Methods called within the ERB template are not detected Methods called within the ERB template are not generated in the component output Feb 7, 2023
@marcoroth marcoroth added enhancement New feature or request and removed wrong converter output labels Feb 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants