command line erb?

Hi

Is there a command line ERB?

I’ve heard of one but if I look for an ERB executable I can’t see one

I am in windows, I don’t know if there is one in linux but not in windows? if perhaps the issue is different distros of ruby , I don’t know which distro I have / how to find out.

Thanks

Is there a command line ERB?

I suspect you're looking for "irb" -- Interactive Ruby.

I am in windows, I don't know if there is one in linux but not in windows? if perhaps the issue is different distros of ruby , I don't know which distro I have / how to find out.

I can't help with the windows part, but how did you install Ruby? Where is the ruby executable? I would think there would be an "irb" executable in the same directory.

Also, `ruby --version` should tell you what you have installed.

HTH!

No, ERB is not IRB. ERB is called Embedded Ruby, people often use it when they use Rails.

rails console?

So what would a "command line ERB" do exactly?

No not the rails console!

ERB stands for Embedded Ruby!

You know when you do rails generate controller abc def

you get a file def.html.erb

that’s an ERB file, an Embedded Ruby file

The contents of that file get preprocessed , such that anything outside of <%…%> gets outputted, and anything inside <%…%> gets executed and <%=…%> involves execution and a result outputted.

PHP has a similar concept… PHP though also has a PHP.EXE file that you can run a file through and get the output.

I see it now, it’s mentioned here

C:\Ruby24-x64\bin>dir erb.* /s/b

C:\Ruby24-x64\bin\erb

C:\Ruby24-x64\bin\erb.cmd

C:\Ruby24-x64\bin>

C:\blah>type a.erb

<%= 5 %>

C:\blah>erb a.erb

5

C:\blah>

Ok I understand, sorry but I never need a thing such these so I can’t help you.

Mauro

Well, you learn something every day :grinning:

In 10 years of developing Rails apps I've never had a use case that required that, but good to know...

Yes ok you couldn’t help with that but I found the answer eventually, I mentioned it in my post, so it’s ok. Thanks…

This solved my problem. Thanks!