You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: paginated.rb
    path of file: ./repos/activegraph/lib/active_graph
    
    the code of the file until where you have to start completion: module ActiveGraph
  class Paginated
    include Enumerable
    attr_reader :items, :total, :current_page

    d
    
    def self.create_from(source, page, per_page, order = nil)
      target = source.node_var || source.identity
      partial = source.skip((page - 1) * per_page).limit(per_page)
      ordered_partial, ordered_source = if order
                                          [partial.order_by(order), source.query.with("#{target} as #{target}").pluck("COUNT(#{target})").first]
                                        else
                                          [partial, source.count]
                                        end