command line erb?

72 views
Skip to first unread message

Robert Phillips

unread,
Feb 25, 2018, 12:08:48 PM2/25/18
to Ruby on Rails: Talk
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

Hassan Schroeder

unread,
Feb 25, 2018, 12:29:36 PM2/25/18
to rubyonrails-talk
On Sun, Feb 25, 2018 at 9:08 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

> 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!
--
Hassan Schroeder ------------------------ hassan.s...@gmail.com
twitter: @hassan
Consulting Availability : Silicon Valley or remote

Robert Phillips

unread,
Feb 25, 2018, 12:46:08 PM2/25/18
to Ruby on Rails: Talk


On Sunday, 25 February 2018 17:29:36 UTC, Hassan Schroeder wrote:
On Sun, Feb 25, 2018 at 9:08 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

> Is there a command line ERB?

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

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

 

Mauro Locatelli

unread,
Feb 25, 2018, 12:49:07 PM2/25/18
to rubyonra...@googlegroups.com
rails console?

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/048722b9-806b-4f4c-8443-c5de43785a59%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Hassan Schroeder

unread,
Feb 25, 2018, 1:08:21 PM2/25/18
to rubyonrails-talk
On Sun, Feb 25, 2018 at 9:46 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

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

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

Robert Phillips

unread,
Feb 25, 2018, 1:14:14 PM2/25/18
to Ruby on Rails: Talk
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>




On Sunday, 25 February 2018 17:49:07 UTC, Mauro Locatelli wrote:
rails console?

Il 25 feb 2018 6:46 PM, "Robert Phillips" <robert.p...@gmail.com> ha scritto:


On Sunday, 25 February 2018 17:29:36 UTC, Hassan Schroeder wrote:
On Sun, Feb 25, 2018 at 9:08 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

> Is there a command line ERB?

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

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

 

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-ta...@googlegroups.com.
To post to this group, send email to rubyonra...@googlegroups.com.

Mauro Locatelli

unread,
Feb 25, 2018, 1:18:37 PM2/25/18
to rubyonra...@googlegroups.com
Ok I understand, sorry but I never need a thing such these so I can't help you.

Mauro

To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/55a7aacd-79e0-41d1-beaf-8725f1e7d3ce%40googlegroups.com.

Hassan Schroeder

unread,
Feb 25, 2018, 1:25:56 PM2/25/18
to rubyonrails-talk
On Sun, Feb 25, 2018 at 10:14 AM, Robert Phillips
<robert.p...@gmail.com> wrote:

> C:\blah>type a.erb
> <%= 5 %>
> C:\blah>erb a.erb
> 5
> C:\blah>

Well, you learn something every day 😀

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

Robert Phillips

unread,
Feb 25, 2018, 1:26:54 PM2/25/18
to Ruby on Rails: Talk


On Sunday, 25 February 2018 18:18:37 UTC, Mauro Locatelli wrote:
Ok I understand, sorry but I never need a thing such these so I can't help you.

Mauro



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..

Adam L

unread,
Feb 21, 2019, 12:15:47 PM2/21/19
to Ruby on Rails: Talk
This solved my problem. Thanks!
Reply all
Reply to author
Forward
0 new messages