Sha256: 4a2617a842090f16fa0681c852ae254da1de4625ede7d243564aa6fecf2dc602

Contents?: true

Size: 571 Bytes

Versions: 3

Compression:

Stored size: 571 Bytes

Contents

module Pakyow
  module UI
    # Manages mutations.
    #
    # Intended only for use in development or single app-instance deployments.
    #
    # @api private
    class SimpleMutationRegistry
      include Singleton

      def initialize
        reset
      end

      def reset
        @mutations = {}
      end

      def register(scope, mutation)
        @mutations[scope] ||= []

        return if @mutations[scope].include?(mutation)
        @mutations[scope] << mutation
      end

      def mutations(scope)
        @mutations[scope]
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
pakyow-ui-0.10.2 pakyow-ui/lib/pakyow-ui/registries/simple_mutation_registry.rb
pakyow-ui-0.10.1 pakyow-ui/lib/pakyow-ui/registries/simple_mutation_registry.rb
pakyow-ui-0.10.0 pakyow-ui/lib/pakyow-ui/registries/simple_mutation_registry.rb