Sha256: 4eba3a29d49f8e503452d5a4d004a97b61a851ca63117e56d54e87e95120f2ea

Contents?: true

Size: 1.37 KB

Versions: 106

Compression:

Stored size: 1.37 KB

Contents

RGen can compile any ASCII files within the context of a target, in other words
you can select a target file and access the objects instantiated in the target
from here and use them to generate dynamic content.

To try it run the compile task on this file:

> rgen c templates/example.txt.erb

You can also compile entire directories like this:

> rgen c templates

In the case of compiling a directory any .erb files in the directory and its
subdirectory will be compiled, whereas any non .erb files will simply be
copied over to the output location un-modified.

See the help for the other available options:

> rgen c -h

SYNTAX
------

The syntax is very simple:

% # Lines that start with % (no spaces allowed before it) will be interpreted
% # as Ruby. Since these lines start with a comment char they will simply be
% # deleted by the compilation process.

Ruby logic can be used to conditionally include lines:
% if 1 == 1 
  You will see me in the compiled file
% else
  But you won't see me :-(
% end

Loops can be used to expand the content:
% 10.times do
  I must not talk in class
% end

To inject content use this syntax: 4 + 4 = <%= 4 + 4 %>

Whatever is returned by a Ruby snippet like this will be converted to a string and
output to the compiled file.

That's pretty much it.

Oh almost forgot the best bit, you can access your objects:

"DUT, are you there?"

<%= $dut.say_hello %>

Version data entries

106 entries across 106 versions & 1 rubygems

Version Path
origen_testers-0.5.3 templates/example.txt.erb
origen_testers-0.5.2 templates/example.txt.erb
origen_testers-0.5.1 templates/example.txt.erb
origen_testers-0.5.0 templates/example.txt.erb
origen_testers-0.4.1 templates/example.txt.erb
origen_testers-0.4.0 templates/example.txt.erb