Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't find the ERB gem

Tags:

ruby

erb

I know how to use erb, and have done so on rails and in standalone ruby apps.. I don't know where it came from, as I have never installed it but it's there. I used rbenv on my mac.

I installed ruby on a windows 8 computer using the rails installer and can't seem to access erb.

how do you install erb??? (Or is there something I'm missing)

like image 431
Zach Smith Avatar asked Feb 28 '15 20:02

Zach Smith


1 Answers

ERB module comes with standard libaray in Ruby. You just need to require it.

require 'erb'

temp = "<%= var %>"

erb = ERB.new(temp)
var = "hi" 
erb.result(binding) # => "hi"
like image 176
Arup Rakshit Avatar answered Sep 30 '22 05:09

Arup Rakshit