module Card::Env::Support

utility methods for Card::Env

Public Instance Methods

hash(hashish) click to toggle source
# File lib/card/env/support.rb, line 13
def hash hashish
  case hashish
  when Hash then hashish.clone
  when ActionController::Parameters then hashish.to_unsafe_h
  else {}
  end
end
reset_session() click to toggle source
# File lib/card/env/support.rb, line 21
def reset_session
  if session.is_a? Hash
    @session = {}
  else
    controller&.reset_session
  end
end
with_params(hash) { || ... } click to toggle source
# File lib/card/env/support.rb, line 5
def with_params hash
  old_params = params.clone
  params.merge! hash
  yield
ensure
  @params = old_params
end