Sha256: 33458516bda6038794be8da0ec661b52fdbd1d4a16feb33fff6092a388ee2f9d

Contents?: true

Size: 1.15 KB

Versions: 9

Compression:

Stored size: 1.15 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!

end # Vedeu

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
vedeu-0.6.29 lib/vedeu/runtime/flags.rb
vedeu-0.6.28 lib/vedeu/runtime/flags.rb
vedeu-0.6.27 lib/vedeu/runtime/flags.rb
vedeu-0.6.26 lib/vedeu/runtime/flags.rb
vedeu-0.6.25 lib/vedeu/runtime/flags.rb
vedeu-0.6.24 lib/vedeu/runtime/flags.rb
vedeu-0.6.23 lib/vedeu/runtime/flags.rb
vedeu-0.6.22 lib/vedeu/runtime/flags.rb
vedeu-0.6.21 lib/vedeu/runtime/flags.rb