Sha256: 37f8c114d9294ad5ee4393d7f2578c218dfa7f1101aa1b6a27271b3dd612e4ed

Contents?: true

Size: 601 Bytes

Versions: 4

Compression:

Stored size: 601 Bytes

Contents

class RedisSnippets::Snippets
  class << self
    def update(key, content)
      raise "#{key} not in the specified keys." unless RedisSnippetsEngine.config.redis_snippets[:keys].include?(key)
      RedisSnippets::Redis.set("snippets:#{key}", content)
    end

    def del(key)
      RedisSnippets::Redis.del("snippets:#{key}")
    end

    # Retrieve snippet.
    def method_missing(method, *args)
      raise "#{method} not in the specified keys." unless RedisSnippetsEngine.config.redis_snippets[:keys].include?(method.to_sym)
      RedisSnippets::Redis.get("snippets:#{method}")
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
redis_snippets-0.0.4 app/models/redis_snippets/snippets.rb
redis_snippets-0.0.3 app/models/redis_snippets/snippets.rb
redis_snippets-0.0.2 app/models/redis_snippets/snippets.rb
redis_snippets-0.0.1 app/models/redis_snippets/snippets.rb