Method: Lookbook::CodeIndenter#call

Defined in:
lib/lookbook/services/code/code_indenter.rb

#callObject



7
8
9
10
11
12
# File 'lib/lookbook/services/code/code_indenter.rb', line 7

def call
  source = @source.chomp
  last = source.split(/\r?\n/).last
  indent = last ? last[/^([ \t]*)/, 1].length : 0
  source.gsub(/^[ \t]{#{indent}}/, "")
end