Class: HtmlFormatter::RubyIndenter
- Inherits:
-
Object
- Object
- HtmlFormatter::RubyIndenter
- Defined in:
- lib/htmlformatter/ruby_indenter.rb
Constant Summary collapse
- INDENT_KEYWORDS =
%w[ if elsif else unless while until begin for ]- OUTDENT_KEYWORDS =
%w[ elsif else end ]- RUBY_INDENT =
%r{ ^ ( #{INDENT_KEYWORDS.join("|")} )\b | \b ( do | \{ ) ( \s* \| [^\|]+ \| )? $ }xo
- RUBY_OUTDENT =
%r{ ^ ( #{OUTDENT_KEYWORDS.join("|")} | \} ) \b }xo
Instance Method Summary collapse
Instance Method Details
#indent?(lines) ⇒ Boolean
15 16 17 |
# File 'lib/htmlformatter/ruby_indenter.rb', line 15 def indent?(lines) lines.last =~ RUBY_INDENT end |
#outdent?(lines) ⇒ Boolean
11 12 13 |
# File 'lib/htmlformatter/ruby_indenter.rb', line 11 def outdent?(lines) lines.first =~ RUBY_OUTDENT end |