Module: Ronin::Templates::Erb

Included Modules

Ronin::Templates::Template

Public Visibility

Public Instance Method Summary

#erb(template)

Renders the inline ERB template in the scope of the object.

Returns: String

#erb_file(template_path)

Renders an ERB template file in the scope of the object.

Returns: String

Public Instance Method Details

erb

public String erb(template)

Renders the inline ERB template in the scope of the object.

Meta Tags

Example:

  @user = 'lolcats'

  erb %{
  USER: <%= @user %>
  PASSWORD: <%= @user.reverse %>
  }
  # => "\nUSER: lolcats\nPASSWORD: staclol\n"

Parameters:

[String] template

Source of the ERB template.

Returns:

[String]

Result of the rendered template.

[View source]


47
48
49
# File 'lib/ronin/templates/erb.rb', line 47

def erb(template)
  ERB.new(template).result(binding)
end

erb_file

public String erb_file(template_path)

Renders an ERB template file in the scope of the object.

Meta Tags

Example:

  erb_file 'path/to/template.erb'

Parameters:

[String] template_path

The relative path of the ERB template.

Returns:

[String]

Result of the rendered template.

[View source]


63
64
65
66
67
# File 'lib/ronin/templates/erb.rb', line 63

def erb_file(template_path)
  enter_template(template_path) do |path|
    erb(File.read(path))
  end
end

Protected Visibility

Generated on Friday, September 25 2009 at 02:57:23 PM by YARD 0.2.3.5 (ruby-1.8.6).