Sha256: f0d77dabffcba5717695b5ab110d476af1d85c03f24744cfd80247603c9e2397

Contents?: true

Size: 897 Bytes

Versions: 3

Compression:

Stored size: 897 Bytes

Contents

module Riot
  module ContextOptions

    # Set options for the specific context. These options will generally be used for context middleware.
    # Riot::Context does not currently look at any options.
    #
    #   context "Foo" do
    #     set :transactional, true
    #   end
    #
    # @param [Object] key the key used to look up the option value later
    # @param [Object] value the option value to store
    def set(key, value)
      option_set[key] = value
    end

    # Returns the value of a set option. The key must match exactly, symbols and strings are not
    # interchangeable.
    #
    # @param [Object] key the key used to look up the option value
    # @return [Object]
    def option(key)
      option_set[key]
    end

    # Returns the hash of defined options.
    #
    # @return [Hash]
    def option_set
      @options ||= {}
    end

  end # ContextOptions
end # Riot

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
riot-0.12.7 lib/riot/context_options.rb
riot-0.12.6 lib/riot/context_options.rb
riot-0.12.5 lib/riot/context_options.rb