jnicklas/turnip

View on GitHub
lib/turnip/node/location.rb

Summary

Maintainability
A
0 mins
Test Coverage
module Turnip
  module Node
    #
    # @note Location metadata generated by Gherkin
    #
    #     {
    #       line: 10,
    #       column: 3
    #     }
    #
    class Location
      attr_reader :line,
                  :column

      def initialize(line, column)
        @line = line
        @column = column
      end
    end

    module HasLocation
      #
      # @return [Location]
      #
      def location
        @location ||= Location.new(@raw[:location][:line], @raw[:location][:column])
      end

      def line
        location.line
      end
    end
  end
end