Sha256: cf1c3e5c5a645044eaa98b52f018861f065907420bd77582509af607d51091a1
Contents?: true
Size: 936 Bytes
Versions: 2
Compression:
Stored size: 936 Bytes
Contents
require "extface/engine" require "extface/routes" require "extface/mapping" require "extface/extfaceable" require "extface/extfaceable" require "redis-namespace" module Extface mattr_accessor :redis_connection_string mattr_reader :mappings @@mappings = ActiveSupport::OrderedHash.new class << self def setup yield self end def add_mapping(resource, options) mapping = Extface::Mapping.new(resource, options) @@mappings[mapping.name] = mapping end def redis_block r = redis_instance begin yield Redis::Namespace.new(:extface, :redis => r) ensure r.quit end end private def redis_instance if @@redis_connection_string uri = URI.parse(@@redis_connection_string) Redis.new(host: uri.host, port: uri.port, password: uri.password) else Redis.new end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
extface-0.0.6 | lib/extface.rb |
extface-0.0.5 | lib/extface.rb |