Sha256: fa1792bde0b779f37beea2ca5ca18ac741e00fc3d3843696c7325472c0f7c300

Contents?: true

Size: 631 Bytes

Versions: 7

Compression:

Stored size: 631 Bytes

Contents

require "liquidscript/icr/representable"

module Liquidscript
  class Scanner
    class Token

      attr_accessor :type
      attr_accessor :value
      attr_reader :line
      attr_reader :column

      include Enumerable
      include ICR::Representable

      def initialize(type, value, line, column)
        @type   = type
        @line   = line
        @column = column
        @value  = begin
          value.pack("c*")
        rescue NoMethodError, TypeError
          value
        end
      end

      def to_a
        [@type, @value]
      end

      def type?(type)
        @type == type
      end

    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
liquidscript-0.1.5 lib/liquidscript/scanner/token.rb
liquidscript-0.1.4 lib/liquidscript/scanner/token.rb
liquidscript-0.1.3 lib/liquidscript/scanner/token.rb
liquidscript-0.1.2 lib/liquidscript/scanner/token.rb
liquidscript-0.1.1 lib/liquidscript/scanner/token.rb
liquidscript-0.1.0 lib/liquidscript/scanner/token.rb
liquidscript-0.0.1 lib/liquidscript/scanner/token.rb