Module: PseudoKiosk::Config
- Defined in:
- lib/pseudo_kiosk/config.rb
Class Attribute Summary collapse
-
.unlock_mechanism ⇒ Object
accepts a lambda function or string if lambda function is passed, instance of controller is passed to lambda for access to helper functions like current_user.
Class Method Summary collapse
- .configure(&blk) ⇒ Object
- .configure! ⇒ Object
- .init! ⇒ Object
-
.reset! ⇒ Object
Resets all configuration options to their default values.
- .update! ⇒ Object
- .user_config(&blk) ⇒ Object
Class Attribute Details
.unlock_mechanism ⇒ Object
accepts a lambda function or string if lambda function is passed, instance of controller is passed to lambda for access to helper functions like current_user
8 9 10 |
# File 'lib/pseudo_kiosk/config.rb', line 8 def unlock_mechanism @unlock_mechanism end |
Class Method Details
.configure(&blk) ⇒ Object
33 34 35 36 |
# File 'lib/pseudo_kiosk/config.rb', line 33 def configure(&blk) @configure_blk = blk @configure_blk.call(self) end |
.configure! ⇒ Object
38 39 40 |
# File 'lib/pseudo_kiosk/config.rb', line 38 def configure! @configure_blk.call(self) if @configure_blk end |
.init! ⇒ Object
10 11 12 13 14 |
# File 'lib/pseudo_kiosk/config.rb', line 10 def init! @defaults = { :@unlock_mechanism => nil, } end |
.reset! ⇒ Object
Resets all configuration options to their default values.
17 18 19 20 21 |
# File 'lib/pseudo_kiosk/config.rb', line 17 def reset! @defaults.each do |k, v| instance_variable_set(k, v) end end |
.update! ⇒ Object
23 24 25 26 27 |
# File 'lib/pseudo_kiosk/config.rb', line 23 def update! @defaults.each do |k, v| instance_variable_set(k, v) unless instance_variable_defined?(k) end end |
.user_config(&blk) ⇒ Object
29 30 31 |
# File 'lib/pseudo_kiosk/config.rb', line 29 def user_config(&blk) block_given? ? @user_config = blk : @user_config end |