aboutsummaryrefslogtreecommitdiffstats
path: root/actionview/lib/action_view/template/handlers
Commit message (Collapse)AuthorAgeFilesLines
* Support explicit defintion of resouce name for collection caching.Dov Murik2015-07-071-2/+9
| | | | | | | | | | | | | | If a template includes `# Template Collection: ...` anywhere in its source, that name will be used as the cache name for the partial that is rendered for the collection. This allows users to enable collection caching even if the template doesn't start with `<% cache ... do %>`. Moreover, the `# Template Collection: ...` notation is recognized in all template types (and template types other than ERB can define a resource_cache_call_pattern method to allow the `cache ... do` pattern to be recognized too).
* Improve detection of partial templates eligible for collection caching.Dov Murik2015-06-221-1/+1
| | | | | | | | | | | | | | The regular expression which was used to detect partial templates that begin with a `<% cache ... do %>` call missed some cases. This commits attempts to improve the detection for some cases such as multi-line comments at the beginning of the template. The different templates are listed in two new unit test methods. Note that specially crafted Ruby code can still evade such `cache`-call detection: for example, a user might have its own method which itself calls the Rails `cache` helper. In such a case, the template's code doesn't start with a literal `cache` string and therefore will not be eligible for collection caching.
* Freeze static arguments for gsubbrainopia2015-04-021-1/+1
|
* Prefer string patterns for gsubbrainopia2015-04-021-1/+1
| | | | | | | | | | | | | | | | | https://github.com/ruby/ruby/pull/579 - there is a new optimization since ruby 2.2 Previously regexp patterns were faster (since a string was converted to regexp underneath anyway). But now string patterns are faster and better reflect the purpose. Benchmark.ips do |bm| bm.report('regexp') { 'this is ::a random string'.gsub(/::/, '/') } bm.report('string') { 'this is ::a random string'.gsub('::', '/') } bm.compare! end # string: 753724.4 i/s # regexp: 501443.1 i/s - 1.50x slower
* Collections automatically cache and fetch partials.Kasper Timm Hansen2015-02-211-0/+18
| | | | | | | | | | | | | | | | | | | | | | | Collections can take advantage of `multi_read` if they render one template and their partials begin with a cache call. The cache call must correspond to either what the collections elements are rendered as, or match the inferred name of the partial. So with a notifications/_notification.html.erb template like: ```ruby <% cache notification %> <%# ... %> <% end %> ``` A collection would be able to use `multi_read` if rendered like: ```ruby <%= render @notifications %> <%= render partial: 'notifications/notification', collection: @notifications, as: :notification %> ```
* Some valid block calls in templates caused syntax errorsAkira Matsuda2014-11-201-1/+1
| | | | Now ActionView accepts <%= foo(){ %> and <%= foo()do %> :golf:
* Call gsub with a Regexp instead of a String for better performancePablo Herrero2014-11-011-1/+1
|
* handle <%== nil %> casesAaron Patterson2014-09-141-2/+2
| | | | | This is much less common than string literal appends, so add a special case method for it. Maybe fixes bug reported by @jeremy on 97ef636191933f1d4abc92fc10871e6d1195285c
* optimize string literals in erb templatesAaron Patterson2013-12-031-2/+2
|
* Remove require to AP stuff that leftŁukasz Strzałkowski2013-06-201-1/+0
|
* Move actionpack/lib/action_view* into actionview/libPiotr Sarnacki2013-06-203-0/+183