Class: RBlade::CompilesStatements::CompilesInlineRuby

Inherits:
Object
  • Object
show all
Defined in:
lib/rblade/compiler/statements/compiles_inline_ruby.rb

Instance Method Summary collapse

Instance Method Details

#compile(args) ⇒ Object



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/rblade/compiler/statements/compiles_inline_ruby.rb', line 6

def compile(args)
  if args&.count != 1
    raise RBladeTemplateError.new "Ruby statement: wrong number of arguments (given #{args&.count || 0}, expecting 1)"
  end

  arg = args[0].strip
  if arg[-1] != ";"
    arg << ";"
  end
  arg
end