36 lines
569 B
Ruby
36 lines
569 B
Ruby
|
require 'redis/connection/hiredis'
|
||
|
require 'redis'
|
||
|
|
||
|
require 'yaml'
|
||
|
|
||
|
|
||
|
class Fancy
|
||
|
attr_accessor :has_pants, :likes_to_dance
|
||
|
|
||
|
def initialize(has_pants)
|
||
|
@has_pants = has_pants
|
||
|
@likes_to_dance = true
|
||
|
end
|
||
|
end
|
||
|
|
||
|
|
||
|
def main
|
||
|
redis = Redis.new
|
||
|
|
||
|
inst = Fancy.new('yup!')
|
||
|
|
||
|
puts redis.set('foo', 'bar')
|
||
|
puts redis.set('derp', inst.to_yaml)
|
||
|
puts redis.sadd('hamsters', 'albert')
|
||
|
puts redis.sadd('hamsters', 'walter')
|
||
|
|
||
|
puts redis.get('foo')
|
||
|
puts YAML.load_documents(redis.get('derp'))[0]
|
||
|
puts redis.sinter('hamsters')
|
||
|
end
|
||
|
|
||
|
|
||
|
if $0 == __FILE__
|
||
|
main
|
||
|
end
|