aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template/handlers/erb
Commit message (Collapse)AuthorAgeFilesLines
* Squash `warning: instance variable @filename not initialized`utilum2019-04-121-1/+1
|
* Rename `ActionView::Base#run` to `#_run`Seb Jacobs2019-03-151-1/+1
| | | | | | | | | | | | | | | | | | There was a recent change by @tenderlove to Action view which introduced `ActionView::Base#run` [1]. We ran into an issue with our application because one of the core concepts in our domain model is a `Run` which is exposed in most of our views as a helper method, which now conflicts with this new method. Although this is a public method it is not really meant to be part of the public API. In order to discourage public use of this method and to reduce the chances of this method conflicting with helper methods we can prefix this method with an underscore, renaming this method to `_run`. [1] https://github.com/rails/rails/commit/c740ebdaf5
* Pass the template format to the digestorAaron Patterson2019-02-151-1/+1
| | | | | | | | | | | | | | | This commit passes the template format to the digestor in order to come up with a key. Before this commit, the digestor would depend on the side effect of the template renderer setting the rendered_format on the lookup context. I would like to remove that mutation, so I've changed this to pass the template format in to the digestor. I've introduced a new instance variable that will be alive during a template render. When the template is being rendered, it pushes the current template on to a stack, setting `@current_template` to the template currently being rendered. When the cache helper asks the digestor for a key, it uses the format of the template currently on the stack.
* Turn lookup context in to a stack, push and pop if formats changeAaron Patterson2019-02-111-1/+1
| | | | | | | | | | | This commit keeps a stack of lookup contexts on the ActionView::Base instance. If a format is passed to render, we instantiate a new lookup context and push it on the stack, that way any child calls to "render" will use the same format information as the parent. This also isolates "sibling" calls to render (multiple calls to render in the same template). Fixes #35222 #34138
* Tighten up the AV::Base constructorAaron Patterson2019-01-291-1/+1
| | | | | | | | | | | | | | | The AV::Base constructor was too complicated, and this commit tightens up the parameters it will take. At runtime, AV::Base is most commonly constructed here: https://github.com/rails/rails/blob/94d54fa4ab641a0ddeb173409cb41cc5becc02a9/actionview/lib/action_view/rendering.rb#L72-L74 This provides an AV::Renderer instance, a hash of assignments, and a controller instance. Since this is the common case for construction, we should remove logic from the constructor that handles other cases. This commit introduces special constructors for those other cases. Interestingly, most code paths that construct AV::Base "strangely" are tests.
* Pull buffer assignment upAaron Patterson2019-01-161-1/+1
| | | | | Since everything goes through a `run` method, we can pull the buffer assignment up.
* Always evaluate views against an ActionView::BaseAaron Patterson2019-01-161-4/+6
| | | | | Methods created by views should always be evaluated against an AV::Base instance. This way we can extract and refactor things in to classes.
* Pull output buffer conditional upAaron Patterson2019-01-161-1/+3
| | | | | | This pulls the "output buffer existence" conditional up. Instead of evaling the same conditional over and over, we can pull it in to "only compiled once" Ruby code.
* Remove deprecated Erubis ERB handlerRafael Mendonça França2017-10-232-94/+0
|
* Use frozen string literal in actionview/Kir Shatrov2017-07-243-0/+6
|
* Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-023-3/+0
| | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
* Enforce frozen string in RubocopKir Shatrov2017-07-013-0/+3
|
* call `gem` `erubis` before requireyuuji.yaginuma2017-02-011-0/+1
| | | | For inform that need to add `erubis` to gemfile.
* Fix inherit from deprecated `ActionView::Template::Handlers::Erubis`Fumiaki MATSUSHIMA2017-02-011-0/+9
| | | | | | | | | | There are some classes inherit from `ActionView::Template::Handlers::Erubis`. (ex. https://github.com/haml/haml/blob/4.0.7/lib/haml/helpers/safe_erubis_template.rb#L3) ``` Class.new(ActionView::Template::Handlers::Erubis) # => TypeError: superclass must be a Class (ActiveSupport::Deprecation::DeprecatedConstantProxy given) ```
* Change ActionView ERB Handler from Erubis to ErubiJeremy Evans2017-01-252-0/+161
Erubi offers the following advantages for Rails: * Works with ruby's --enable-frozen-string-literal option * Has 88% smaller memory footprint * Does no freedom patching (Erubis adds a method to Kernel) * Has simpler internals (1 file, <150 lines of code) * Has an open development model (Erubis doesn't have a public source control repository or bug tracker) * Is not dead (Erubis hasn't been updated since 2011) Erubi is a simplified fork of Erubis that contains just the parts that are generally needed (which includes the parts that Rails uses). The only intentional difference in behavior is that it does not include support for <%=== tags for debug output. That could be added to the ActionView ERB handler if it is desired. The Erubis template handler remains in a deprecated state so that code that accesses it directly does not break. It can be removed after Rails 5.1.