Sha256: 340218dc6cf2ce523e5de15cda3f020f9066beff4c7edc1c7c446e371b5fec35

Contents?: true

Size: 526 Bytes

Versions: 1

Compression:

Stored size: 526 Bytes

Contents

# frozen_string_literal: true

module Cursed
  module Adapter
    class Base
      attr_reader :relation

      def initialize(array)
        @relation = array
      end

      def apply_to(cursor)
        attr = cursor.attribute

        after(attr, cursor.after) if cursor.after?

        before(attr, cursor.before) if cursor.before?

        if cursor.forward?
          ascend_by(attr)
        else
          descend_by(attr)
        end

        limit(cursor.clamped_limit)

        relation
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cursed-0.1.0 lib/cursed/adapter/base.rb