Sha256: e1bb8976a8b0f97786f8d1bcb69d20cb3595a01e8d9f92edc628037cdd746a7d

Contents?: true

Size: 977 Bytes

Versions: 3

Compression:

Stored size: 977 Bytes

Contents

module Pakyow
  class App
    class << self
      # Defines mutators for a scope.
      #
      # @api public
      def mutators(scope = nil, &block)
        @mutators ||= {}

        if scope && block
          @mutators[scope] = block
        else
          @mutators || {}
        end
      end

      # Defines a mutable object.
      #
      # @api public
      def mutable(scope, &block)
        @mutables ||= {}
        @mutables[scope] = block
      end

      # @api private
      def mutables
        @mutables || {}
      end
    end

    # Convenience method for defining mutators on an app instance.
    #
    # @api public
    def mutators(scope = nil, &block)
      self.class.mutators(scope, &block)
    end

    # Convenience method for defining a mutable on an app instance.
    #
    # @api public
    def mutable(scope, &block)
      self.class.mutable(scope, &block)
    end

    # @api private
    def mutables
      self.class.mutables
    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/ext/app.rb
pakyow-ui-0.10.1 pakyow-ui/lib/pakyow-ui/ext/app.rb
pakyow-ui-0.10.0 pakyow-ui/lib/pakyow-ui/ext/app.rb