Skip to content

ontje/settings-ohm

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

settings-ohm

Simple Settings Model using Ohm/Redis for data storage.

Description


A simple way to directly set and retrieve settings for your Ohm based app. You can store strings, integers, floats and boolean true/false values. Every setting is set and accessed using a symbol, i.e. Settings[:port]

Usage


In your application:

require "ohm"
require "./settings-ohm"

Ohm.connect

Set settings:

Setting[:name] = "simple settings using Ohm"
Setting[:port] = 3456
Setting[:open] = true

Retrieve settings:

Setting[:name] # => "simple settings using Ohm"
Setting[:port] # => 3456
Setting[:open] # => true

# unset settings return nil
Setting[:adress] # => nil

Instead of raising an error, using anything other than a symbol as an identifier will return false

Setting["string as an identifier"] # => false

About

simple settings for ohm based apps

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages