Module: Lazibi::Helper::BeautifyFilterHelper

Included in:
Filter::Beautify
Defined in:
lib/helper/beautify_filter_helper.rb

Instance Method Summary collapse

Instance Method Details

#indent_expObject



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/helper/beautify_filter_helper.rb', line 12

def indent_exp
  [
    /^module\b/,
    /(=\s*|^|<<\s*)if\b/,
    /(=\s*|^|<<\s*)until\b/,
    /(=\s*|^|<<\s*)for\b/,
    /(=\s*|^|<<\s*)unless\b/,
    /(=\s*|^|<<\s*)while\b/,
    /(=\s*|^|<<\s*)begin\b/,
    /(=\s*|^|<<\s*)loop\b/,
    #    /\bthen\b/,
    /\bcase\b/,
    /^class\b/,
    /^rescue\b/,
    /^def\b/,
    /\sdo\b/,
    /^else\b/,
    /^elsif\b/,
    /^ensure\b/,
    /\bwhen\b/,
    /\{[^\}]*$/,
    /\[[^\]]*$/
  ]
end

#outdent_expObject



37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/helper/beautify_filter_helper.rb', line 37

def outdent_exp
  [
    /^rescue\b/,
    /^ensure\b/,
    /^elsif\b/,
    #    /\bthen\b/,
    /^end\b/,
    /^else\b/,
    /\bwhen\b/,
    /^[^\{]*\}/,
    /^[^\[]*\]/
  ]
end

#tab_sizeObject



4
5
6
# File 'lib/helper/beautify_filter_helper.rb', line 4

def tab_size
  2
end

#tab_strObject



8
9
10
# File 'lib/helper/beautify_filter_helper.rb', line 8

def tab_str
  " "
end