Sha256: bc1cd080aff1bcc404740a975c7d1a7054891c505c0e2dd18a3961e11f891041

Contents?: true

Size: 823 Bytes

Versions: 24

Compression:

Stored size: 823 Bytes

Contents

module Cucumber
  module Ast

    class Location
      attr_reader :file, :line

      def initialize(file, line)
        @file = file || raise(ArgumentError, "file is mandatory")
        @line = line || raise(ArgumentError, "line is mandatory")
      end

      def to_s
        "#{file}:#{line}"
      end

      def on_line(new_line)
        Location.new(file, new_line)
      end
    end

    module HasLocation
      def file_colon_line
        location.to_s
      end

      def file
        location.file
      end

      def line
        location.line
      end

      def location
        raise('Please set @location in the constructor') unless @location
        raise("@location must be an Ast::Location but is a #{@location.class}") unless @location.is_a?(Location)
        @location
      end
    end
  end
end

Version data entries

24 entries across 22 versions & 2 rubygems

Version Path
honeybadger-2.4.0 vendor/gems/ruby/2.1.0/gems/cucumber-1.3.16/lib/cucumber/ast/location.rb
honeybadger-2.4.0 vendor/gems/ruby/2.2.0/gems/cucumber-1.3.18/lib/cucumber/ast/location.rb
honeybadger-2.4.0 vendor/gems/ruby/1.9.1/gems/cucumber-1.3.18/lib/cucumber/ast/location.rb
cucumber-1.3.20 lib/cucumber/ast/location.rb
cucumber-1.3.19 lib/cucumber/ast/location.rb
cucumber-1.3.18 lib/cucumber/ast/location.rb
cucumber-1.3.17 lib/cucumber/ast/location.rb
cucumber-1.3.16 lib/cucumber/ast/location.rb
cucumber-1.3.15 lib/cucumber/ast/location.rb
cucumber-1.3.14 lib/cucumber/ast/location.rb
cucumber-1.3.13 lib/cucumber/ast/location.rb
cucumber-1.3.12 lib/cucumber/ast/location.rb
cucumber-1.3.11 lib/cucumber/ast/location.rb
cucumber-1.3.10 lib/cucumber/ast/location.rb
cucumber-1.3.9 lib/cucumber/ast/location.rb
cucumber-1.3.8 lib/cucumber/ast/location.rb
cucumber-1.3.7 lib/cucumber/ast/location.rb
cucumber-1.3.6 lib/cucumber/ast/location.rb
cucumber-1.3.5 lib/cucumber/ast/location.rb
cucumber-1.3.4 lib/cucumber/ast/location.rb