lib/rib/extra/autoindent.rb in rib-1.0.0 vs lib/rib/extra/autoindent.rb in rib-1.0.1

- old
+ new

@@ -1,6 +1,7 @@ +require 'rib/core/history' # otherwise the order might be wrong require 'rib/core/readline' # dependency require 'rib/core/multiline' # dependency module Rib::Autoindent include Rib::Plugin @@ -60,11 +61,11 @@ # --------------- Rib API --------------- def before_loop return super if Autoindent.disabled? - config[:autoindent_spaces] ||= ' ' + autoindent_spaces super end def get_input return super if Autoindent.disabled? @@ -143,10 +144,14 @@ private def current_autoindent size=autoindent_stack.size - config[:autoindent_spaces] * size + autoindent_spaces * size + end + + def autoindent_spaces + config[:autoindent_spaces] ||= ' ' end def autoindent_stack @autoindent_stack ||= [] end