Class: Twitter::Cache::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/twitter/cache/config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize {|_self| ... } ⇒ Config

Returns a new instance of Config.

Yields:

  • (_self)

Yield Parameters:



6
7
8
9
# File 'lib/twitter/cache/config.rb', line 6

def initialize
  @namespace = 'twitter-cache-gem'
  yield(self) if block_given?
end

Instance Attribute Details

#namespaceObject

Returns the value of attribute namespace.



4
5
6
# File 'lib/twitter/cache/config.rb', line 4

def namespace
  @namespace
end

#redisObject

Returns the value of attribute redis.



4
5
6
# File 'lib/twitter/cache/config.rb', line 4

def redis
  @redis
end

#ttlObject

Returns the value of attribute ttl.



4
5
6
# File 'lib/twitter/cache/config.rb', line 4

def ttl
  @ttl
end

Instance Method Details

#convert_user(raw) ⇒ Object



21
22
23
24
# File 'lib/twitter/cache/config.rb', line 21

def convert_user(raw)
  return raw unless @user_instance
  @user_instance.call(raw)
end

#user_instance(&block) ⇒ Object



11
12
13
# File 'lib/twitter/cache/config.rb', line 11

def user_instance(&block)
  @user_instance = block
end