Sha256: 3ec1707aaf62c0748039e753b4311484dd2121ebf044c27a8441f5333a91f355

Contents?: true

Size: 1.42 KB

Versions: 2

Compression:

Stored size: 1.42 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

2 entries across 2 versions & 1 rubygems

Version Path
origen_testers-0.13.2 templates/example.txt.erb
origen_testers-0.10.0 templates/example.txt.erb