Sha256: 7a344dfbed0dc080de2bb1ab5c84124cd89cce76136fdfac934d79e75ea563fe
Contents?: true
Size: 530 Bytes
Versions: 3
Compression:
Stored size: 530 Bytes
Contents
# frozen_string_literal: true module HtmlBeautifier class RubyIndenter INDENT_KEYWORDS = %w[if elsif else unless while until begin for].freeze OUTDENT_KEYWORDS = %w[elsif else end].freeze RUBY_INDENT = %r{ ^ ( #{INDENT_KEYWORDS.join("|")} )\b | \b ( do | \{ ) ( \s* \| [^|]+ \| )? $ }xo RUBY_OUTDENT = %r{ ^ ( #{OUTDENT_KEYWORDS.join("|")} | \} ) \b }xo def outdent?(lines) lines.first =~ RUBY_OUTDENT end def indent?(lines) lines.last =~ RUBY_INDENT end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
htmlbeautifier-1.4.2 | lib/htmlbeautifier/ruby_indenter.rb |
htmlbeautifier-1.4.1 | lib/htmlbeautifier/ruby_indenter.rb |
htmlbeautifier-1.4.0 | lib/htmlbeautifier/ruby_indenter.rb |