Sha256: 8d07c7a490cde4d2e0935a1187cee3f7a6b2dd2ea3245038e3d4990edfc62f13

Contents?: true

Size: 755 Bytes

Versions: 6

Compression:

Stored size: 755 Bytes

Contents

module Byebug
  # Implements byebug "source" command.
  class SourceCommand < Command
    self.allow_in_control = true
    
    def regexp
      /^\s* so(?:urce)? \s+ (.+) $/x
    end
    
    def execute
      file = File.expand_path(@match[1]).strip
      unless File.exist?(file)
        errmsg "Command file '#{file}' is not found\n"
        return
      end
      if @state and @state.interface
        @state.interface.command_queue += File.open(file).readlines
      else
        Byebug.run_script(file, @state)
      end
    end
    
    class << self
      def help_command
        'source'
      end
      
      def help(cmd)
        %{
          source FILE\texecutes a file containing byebug commands
        }
      end
    end
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
byebug-1.1.0 lib/byebug/commands/source.rb
byebug-1.0.3 lib/byebug/commands/source.rb
byebug-1.0.2 lib/byebug/commands/source.rb
byebug-1.0.1 lib/byebug/commands/source.rb
byebug-1.0.0 lib/byebug/commands/source.rb
byebug-0.0.1 lib/byebug/commands/source.rb