Module: Riot::ContextOptions

Included in:
Context
Defined in:
lib/riot/context_options.rb

Instance Method Summary collapse

Instance Method Details

#option(key) ⇒ Object

Returns the value of a set option. The key must match exactly, symbols and strings are not interchangeable.

Parameters:

  • key (Object)

    the key used to look up the option value

Returns:



22
23
24
# File 'lib/riot/context_options.rb', line 22

def option(key)
  option_set[key]
end

#option_setHash

Returns the hash of defined options.

Returns:

  • (Hash)


29
30
31
# File 'lib/riot/context_options.rb', line 29

def option_set
  @options ||= {}
end

#set(key, value) ⇒ Object

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

Parameters:

  • key (Object)

    the key used to look up the option value later

  • value (Object)

    the option value to store



13
14
15
# File 'lib/riot/context_options.rb', line 13

def set(key, value)
  option_set[key] = value
end