Skip to main content
Z

Ruby / Lua / Perl Formatter — Reindent Three Languages

Reindent only — not a full formatter

Reindent Ruby, Lua, or Perl source. One tool, three keyword-driven languages.

Free No signup Client-side Privacy friendly Updated

How to use

  1. 1 Pick the language: Ruby, Lua, or Perl.
  2. 2 Paste source code.
  3. 3 Tune indent size — 2 spaces is idiomatic for Ruby, 2 or 4 for Lua and Perl.
  4. 4 Copy or download the result.

Why use this tool

  • One tool covers three syntactically similar block-end-keyword languages.
  • Per-language openers: <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">do/end</code> for Ruby, <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">function/end</code> for Lua, braces for Perl.
  • Pure client-side — your code never leaves the browser.
  • For canonical output use RuboCop (Ruby), StyLua (Lua), or perltidy (Perl) locally.

Frequently asked questions

Is this RuboCop-compatible?

No — this is a reindenter only. RuboCop applies hundreds of style cops; we apply indent rules based on block-opening keywords.

Does it understand here-docs and string interpolation?

Indent is computed line-by-line, so here-doc bodies may receive an extra leading space. For files heavy in here-docs, run the language-specific formatter.

Why is one tool for three languages?

Block structure is similar — single keyword opens, <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">end</code> or <code class="rounded bg-slate-100 px-1 text-xs dark:bg-slate-800">}</code> closes. One rule engine, three keyword sets.

What is Ruby / Lua / Perl Formatter?

A Ruby / Lua / Perl Formatter is a tool that reindents Ruby, Lua, or Perl source code in the browser. It combines three keyword-driven languages into one formatter, applying consistent indentation based on each language's block structure while running entirely client-side.

Features

Keyword-block aware

Understands `end`-terminated blocks (Ruby/Lua) and brace blocks (Perl) to indent correctly.

Three languages

Pick Ruby, Lua, or Perl — each with the right block-open and block-close rules.

100% private

Runs client-side — your source is never uploaded.

Example

Input

class Foo
def bar(x)
return x*2
end
end

Output

class Foo
  def bar(x)
    return x*2
  end
end

Common use cases

  1. 1

    Fix pasted scripts

    Repair indentation on Ruby, Lua, or Perl copied from a chat or PDF.

  2. 2

    Standardize nesting

    Apply consistent 2-space nesting across a script.

  3. 3

    Quick readability pass

    Tidy layout before sharing without a full linter setup.

Summary

Zerethon's Ruby / Lua / Perl formatter reindents source in your browser, tracking keyword blocks (`def`/`do`/`end` in Ruby and Lua; braces in Perl) as well as literal brackets. It defaults to 2-space indentation. It is a lightweight reindenter, not a full RuboCop or perltidy — it fixes nesting without reflowing code. Nothing is uploaded.

Category
Developer
Pricing
Free
Privacy
Browser-based
Signup
Not required

References

Privacy

Your data never leaves your browser unless explicitly stated. Ruby / Lua / Perl Formatter runs entirely client-side — no server upload, no logging, no tracking of your input.

Related tools

Build, share, and grow on Zerethon Social

Free signup. Earn points, collect achievements, and connect with creators worldwide.

Sign up free