Sha256: 0b291a1ecdbd9ef22086a3d305e41a8a24e0e6741afc4fb8e78983f9ec9402c2

Contents?: true

Size: 779 Bytes

Versions: 7

Compression:

Stored size: 779 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
      return print SourceCommand.help(nil) if
        SourceCommand.names.include?(@match[0])

      file = File.expand_path(@match[1]).strip
      return errmsg "File \"#{file}\" not found\n" unless File.exist?(file)

      if @state and @state.interface
        @state.interface.command_queue += File.open(file).readlines
      else
        Byebug.run_script(file, @state)
      end
    end

    class << self
      def names
        %w(source)
      end

      def description
        %{source FILE\texecutes a file containing byebug commands}
      end
    end
  end

end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
byebug-1.8.1 lib/byebug/commands/source.rb
byebug-1.8.0 lib/byebug/commands/source.rb
byebug-1.7.0 lib/byebug/commands/source.rb
byebug-1.6.1 lib/byebug/commands/source.rb
byebug-1.6.0 lib/byebug/commands/source.rb
byebug-1.5.0 lib/byebug/commands/source.rb
byebug-1.4.2 lib/byebug/commands/source.rb