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



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

def compile args
  if args&.count != 1
    raise StandardError.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