Sha256: e9ab12070d28169c55825abb1cd75183fe0b9a08bb7f86246d4454541dca2d1e

Contents?: true

Size: 1.3 KB

Versions: 20

Compression:

Stored size: 1.3 KB

Contents

module Vedeu

  module Runtime

    # Home of various runtime flags which Vedeu uses.
    #
    class Flags

      include Singleton

      class << self

        # @return [Boolean]
        def ready!
          instance.options[:ready] = true
        end

        # @return [Boolean]
        def ready?
          instance.options[:ready]
        end

        # Reset the flags to the default values.
        #
        # @return [Hash]
        def reset!
          instance.reset!
        end

      end # Eigenclass

      # @!attribute [rw]
      # @return [Hash]
      attr_accessor :options

      # Create a new singleton instance of Vedeu::Runtime::Flags.
      #
      # @return [Vedeu::Runtime::Flags]
      def initialize
        self.options = defaults
      end

      # @return [Hash]
      def reset!
        self.options = defaults
      end

      private

      # @return [Hash]
      def defaults
        {
          ready: false
        }
      end

    end # Flags

  end # Runtime

  # Manipulate the internal flags.
  #
  # @!method ready?
  # @!method ready!
  # @return [Boolean]
  def_delegators Vedeu::Runtime::Flags,
                 :ready?,
                 :ready!

  # :nocov:

  # See {file:docs/events/system.md#\_initialize_}
  Vedeu.bind(:_initialize_) { Vedeu.ready! }

  # :nocov:

end # Vedeu

Version data entries

20 entries across 20 versions & 1 rubygems

Version Path
vedeu-0.6.69 lib/vedeu/runtime/flags.rb
vedeu-0.6.68 lib/vedeu/runtime/flags.rb
vedeu-0.6.67 lib/vedeu/runtime/flags.rb
vedeu-0.6.66 lib/vedeu/runtime/flags.rb
vedeu-0.6.65 lib/vedeu/runtime/flags.rb
vedeu-0.6.64 lib/vedeu/runtime/flags.rb
vedeu-0.6.63 lib/vedeu/runtime/flags.rb
vedeu-0.6.62 lib/vedeu/runtime/flags.rb
vedeu-0.6.61 lib/vedeu/runtime/flags.rb
vedeu-0.6.60 lib/vedeu/runtime/flags.rb
vedeu-0.6.59 lib/vedeu/runtime/flags.rb
vedeu-0.6.58 lib/vedeu/runtime/flags.rb
vedeu-0.6.57 lib/vedeu/runtime/flags.rb
vedeu-0.6.56 lib/vedeu/runtime/flags.rb
vedeu-0.6.54 lib/vedeu/runtime/flags.rb
vedeu-0.6.53 lib/vedeu/runtime/flags.rb
vedeu-0.6.52 lib/vedeu/runtime/flags.rb
vedeu-0.6.51 lib/vedeu/runtime/flags.rb
vedeu-0.6.50 lib/vedeu/runtime/flags.rb
vedeu-0.6.49 lib/vedeu/runtime/flags.rb