Module: Waw::FullState::OnInstance
- Included in:
- ActionController, Session
- Defined in:
- lib/waw/fullstate/on_instance.rb
Overview
Provides the introspection methods for installing fullstate utilities on instances.
Instance Method Summary collapse
-
#query_var(name, &block) ⇒ Object
Installs a query variable with a given block.
-
#session_var(name, default_value = nil, &block) ⇒ Object
Installs a friendly session variable on the controller.
Instance Method Details
#query_var(name, &block) ⇒ Object
Installs a query variable with a given block
21 22 23 |
# File 'lib/waw/fullstate/on_instance.rb', line 21 def query_var(name, &block) session_var(name, nil, &block) end |
#session_var(name, default_value = nil, &block) ⇒ Object
Installs a friendly session variable on the controller
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/waw/fullstate/on_instance.rb', line 8 def session_var(name, default_value=nil, &block) var = Waw::FullState::Variable.new(name, default_value, &block) define_method name do var.value(self) end define_method :"#{name}=" do |arg| var.value = arg end rescue ArgumentError => ex raise ex, ex., ex.backtrace[1..-1] end |