Sha256: 7a1ab48927b3d0365aa4a1accc97892682f7c7458769fd0ebd1efb70aca20fd1

Contents?: true

Size: 825 Bytes

Versions: 10

Compression:

Stored size: 825 Bytes

Contents

# frozen_string_literal: true

module Katalyst
  module Tables
    module Collection
      module Query
        class ArrayValueParser < ValueParser
          def initialize(...)
            super

            @value = []
          end

          # @param query [StringScanner]
          def parse(query)
            @query = query

            query.scan(/#{'\['}\s*/)

            until query.eos?
              break unless take_quoted_value || take_unquoted_value
              break unless take_delimiter
            end

            query.scan(/\s*#{'\]'}?/)

            @end = query.charpos

            self
          end

          def take_delimiter
            query.scan(/\s*#{','}\s*/)
          end

          def value=(value)
            @value << value
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
katalyst-tables-3.4.6 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.5 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.4 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.3 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.2 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.1 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.4.0 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.3.4 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.3.3 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb
katalyst-tables-3.3.2 app/models/concerns/katalyst/tables/collection/query/array_value_parser.rb