Sha256: 443be0f2fc5c9fb89cc3668b46353bd3d27a69a82677061b206698d8d1934312

Contents?: true

Size: 768 Bytes

Versions: 2

Compression:

Stored size: 768 Bytes

Contents

require "extface/engine"
require "extface/routes"
require "extface/mapping"
require "extface/extfaceable"
module Extface
  mattr_accessor :redis_connection_string
  
  mattr_reader :mappings
  @@mappings = ActiveSupport::OrderedHash.new
  
  class << self
    def add_mapping(resource, options)
      mapping = Extface::Mapping.new(resource, options)
      @@mappings[mapping.name] = mapping
    end
    
    def redis_block
      r = Redis.new
      begin
        yield r
      ensure
        r.quit
      end
    end
    
    private
      def parse_redis_url
        if @@redis_connection_string
          uri = URI.parse(@@redis_connection_string)
          return {:host => uri.host, :port => uri.port, :password => uri.password}
        end
      end
  end 
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
extface-0.0.2 lib/extface.rb
extface-0.0.1 lib/extface.rb