lib/proteus/modules/defaults_parser.rb
# finds range of lines relevant to a single variable.
# returns nil if the default value is non scalar
finds range of lines relevant to a single variable.
returns nil if the default value is non scalar
finds range of lines relevant to a single variable . returns nil if the default value is non scalar
def find_variable_range(lines, start_index)
        closing_brace_index = 0
        lines[start_index..-1].each_with_index do |line, idx|
          if line =~ /default/ && (line =~ /\[/ || line =~ /\{/)
            return nil
          end
          if line =~ /^\}$/
            closing_brace_index = idx
            break
          end
        end
        lines[start_index..start_index + closing_brace_index]
      end
def find_variable_range ( lines , start_index ) closing_brace_index = 0 lines [ start_index .. - 1 ] . each_with_index do | line , idx | if line =~ / default / && ( line =~ / \[ / || line =~ / \{ / ) return nil end if line =~ / ^ \} $ / closing_brace_index = idx break end end lines [ start_index .. start_index + closing_brace_index ] end
finds range of lines relevant to a single variable.
finds range of lines relevant to a single variable .
# ignore maps and lists
lines
start_index