Questions tagged [erubis]

For questions about Erubis, a fast, secure, and very extensible implementation of Embedded Ruby (eRuby).

Erubis has the following features:

  1. Very fast, almost three times faster than ERB and even 10% faster than eruby
  2. Multi-language support (Ruby/PHP/C/Java/Scheme/Perl/Javascript)
  3. Auto escaping support
  4. Auto trimming spaces around '<% %>'
  5. Embedded pattern changeable (default '<% %>')
  6. Enable to handle Processing Instructions (PI) as embedded pattern (ex. '')
  7. Context object available and easy to combine eRuby template with YAML datafile
  8. Print statement available
  9. Easy to extend and customize in subclass

Erubis is implemented in pure Ruby. It requires Ruby 1.8 or higher. Erubis now supports Ruby 1.9.

Read more

25 questions
1
vote
1 answer

Ruby 2.1 with erubis Template Engine

We are looking for fastest template engine for rendering of views. As i understand erubis is the fastest template engine in ruby. My usecase is render templates through script. Looking at the gem official page it's latest release was in 2011. Not…
abrocks
  • 171
  • 13
1
vote
1 answer

Chef erubis template: Format output based on value's classes

In my Chef cookbook (for mailman), I want use an attribute that is a hash and contains all the configuration options I want to write into a template (similar to how it's done in the chef-client cookbook). So I want to have in my…
StephenKing
  • 36,187
  • 11
  • 83
  • 112
1
vote
1 answer

Rails 2.3.5 with rails_xss escaping content_for yielded content

Just upgraded Rails to 2.3.5 to get the lovely looking rails_xss plugin but I've noticed one big issue with it. Any content_for blocks are escaped when yielded. I've tried hacking it around by doing the either of following but they do not work: <%…
DEfusion
  • 5,533
  • 5
  • 44
  • 60
1
vote
1 answer

How to get list of variable names from an erubis file?

From within a Ruby script, is there a way to pragmatically obtain a list of all expected variable names and function names found in an erubis file? For instance, how would one determine from the Eruby object that the contains the variable…
sutch
  • 1,225
  • 1
  • 13
  • 28
0
votes
1 answer

erubis: `scan': invalid byte sequence in US-ASCII (ArgumentError)

I ran into this error refactoring a small web-service. Interestingly, on the production-server, it works fine. .../erubis-2.7.0/lib/erubis/converter.rb:132:in `scan': invalid byte sequence in US-ASCII (ArgumentError) from…
Chris
  • 5,788
  • 4
  • 29
  • 40
0
votes
1 answer

Erubis not working when executed from PHP

I'm calling a Ruby script from PHP with system('ruby show.rb filename'). The show.rb looks like this: require 'erubis' f = ARGV[0] puts f input = File.read(f) eruby = Erubis::Eruby.new(input) puts eruby.result(binding()) When executing the command…
Martin Cup
  • 2,399
  • 1
  • 21
  • 32
0
votes
1 answer

Create your own tags/functions with Erubis

I have a ruby class that extends Erubis (a ruby templating engine) and I would like to create my own tags. The following is an example of what i'd like to be reproduce: <%= link_to "/some/url" %> This code should generate a html 'a' tag linking to…
Benjamin
  • 617
  • 13
  • 27
0
votes
1 answer

How are elements in an eRubis document cloned throughout the page?

I have a simple eRubis (*.html.erb) document, and want to "copy" various elements throughout a page. Whenever I use simple Ruby statements like this: <%= 3.times do %> ... <% end %> with multiple "times" statements within that to copy more elements…
T145
  • 1,415
  • 1
  • 13
  • 33
0
votes
1 answer

Erubis on Apache httpd.conf and setup?

I am trying to get Erubis setup to process .rhtml files on an Apache web server. I have Ruby installed (v 1.9.2p290) and I installed Erubis(2.7.0) through Ruby Gems. I can't seem to find the proper way to configure the httpd.conf file -- I found a…
Thomas
  • 1,069
  • 4
  • 18
  • 40
-1
votes
1 answer

get ruby hash key value using Erubis

I have a hash: hash = "email_address"=>"test@example.com" I would like to get the value from this hash which is "test@example.com" using erubis. This doesn't work: <% pp hash.[email_address] %>
Rene Zammit
  • 101
  • 1
  • 1
  • 3
1
2