|
|
|||||||||
|
|||||||||
| |||||||||
|
|
|
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Embedded Ruby without Rails
Hi. I started learning ruby and ruby on rails last week. I have a lot of experience with C and perl, including database manipulation with via cgi and using perl to generate javascript, etc.
Ruby seems very nice, but I am starting to find the rails class=table concept repulsive. Also, I do not need rails to do what I want *if* embedded ruby remains feasible. It is not clear to me how realistic that is: can I set out that way and expect to get server support? How? Or is the erb limited to a rails framework, and I should just go learn php instead? ![]() |
|
#2
|
|||
|
|||
|
Quote:
You should probably learn PHP to be honest, but Ruby is a fine language :P |
|
#3
|
|||
|
|||
|
ERB is part of Ruby proper. You can use it without any attachment to Rails. For example:
Code:
irb(main):001:0> require 'erb' => true irb(main):002:0> erb_str = "<%= x %>" => "<%= x %>" irb(main):003:0> template = ERB.new erb_str => #<ERB:0x35b394 @safe_level=nil, @src="_erbout = ''; _erbout.concat(( x ).to_s); _erbout", @filename=nil> irb(main):004:0> x = 42 => 42 irb(main):005:0> puts template.result binding 42 => nil
__________________
Some people have 20 years of experience. Some have 1 year of experience 20 times. My personal site: Basic geek randomness |
![]() |
| Viewing: Dev Shed Forums > Programming Languages > Ruby Programming > Embedded Ruby without Rails |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|