Sha256: cb12fd29049da016230ca3b56d7618ad259a94173da9ca33ce624a1bef3cf329

Contents?: true

Size: 348 Bytes

Versions: 44

Compression:

Stored size: 348 Bytes

Contents

require 'ripper'

module Hamlit
  module Concerns
    module Ripperable
      TYPE_POSITION = 1

      def skip_tokens!(tokens, *types)
        while types.include?(type_of(tokens.first))
          tokens.shift
        end
      end

      def type_of(token)
        return nil unless token
        token[TYPE_POSITION]
      end
    end
  end
end

Version data entries

44 entries across 44 versions & 1 rubygems

Version Path
hamlit-1.5.9 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.8 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.7 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.6 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.5 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.4 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.3 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.2 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.1 lib/hamlit/concerns/ripperable.rb
hamlit-1.5.0 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.7 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.6 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.5 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.3 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.2 lib/hamlit/concerns/ripperable.rb
hamlit-1.4.1 lib/hamlit/concerns/ripperable.rb
hamlit-1.3.2 lib/hamlit/concerns/ripperable.rb
hamlit-1.3.1 lib/hamlit/concerns/ripperable.rb
hamlit-1.3.0 lib/hamlit/concerns/ripperable.rb
hamlit-1.2.1 lib/hamlit/concerns/ripperable.rb