module VariableHelpers
Public Instance Methods
equals?(key, value)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 16 def equals?(key, value) get(key) == value end
exists?(key)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 20 def exists?(key) equals?("#{key}_exists".to_sym, true) end
get(key)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 11 def get(key) @_data ||= {} @_data[key] end
selected?(key, value = nil)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 7 def selected?(key, value = nil) value ? equals?(key, value) : get(key) end
set(key, value)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 2 def set(key, value) @_data ||= {} @_data[key] = value end
Private Instance Methods
ensure_variable(key, default_value)
click to toggle source
# File lib/potassium/helpers/variable-helpers.rb, line 26 def ensure_variable(key, default_value) set(key, get(key) || default_value) end