Sha256: ca76c04b31707e375391c9e1f931e6a6720dd66c4917883c9412a63c0e8f5f2e

Contents?: true

Size: 490 Bytes

Versions: 4

Compression:

Stored size: 490 Bytes

Contents

require 'tsort'

module Scenic
  module MySQLAdapter
    class Views
      include TSort
      include Enumerable

      def initialize(views, graph)
        @views = views
        @graph = graph
      end

      def each(&block)
        @views.each(&block)
      end

      alias :tsort_each_node each

      private def tsort_each_child(node)
        @graph[node.name].each do |child_name|
          yield(@views.find { |v| v.name == child_name })
        end
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
scenic-mysql_adapter-1.1.0 lib/scenic/mysql_adapter/views.rb
scenic-mysql_adapter-1.0.2 lib/scenic/mysql_adapter/views.rb
scenic-mysql_adapter-1.0.1 lib/scenic/mysql_adapter/views.rb
scenic-mysql_adapter-1.0.0 lib/scenic/mysql_adapter/views.rb