Method: Reline::Config#handle_directive

Defined in:
lib/reline/config.rb

#handle_directive(directive, file, no) ⇒ Object



229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
# File 'lib/reline/config.rb', line 229

def handle_directive(directive, file, no)
  directive, args = directive.split(' ')
  case directive
  when 'if'
    condition = false
    case args
    when 'mode'
    when 'term'
    when 'version'
    else # application name
      condition = true if args == 'Ruby'
      condition = true if args == 'Reline'
    end
    @if_stack << [file, no, @skip_section]
    @skip_section = !condition
  when 'else'
    if @if_stack.empty?
      raise InvalidInputrc, "#{file}:#{no}: unmatched else"
    end
    @skip_section = !@skip_section
  when 'endif'
    if @if_stack.empty?
      raise InvalidInputrc, "#{file}:#{no}: unmatched endif"
    end
    @skip_section = @if_stack.pop
  when 'include'
    read(args)
  end
end