Module: Amico::Configuration

Included in:
Amico
Defined in:
lib/amico/configuration.rb

Overview

Configuration settings for Amico.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#blocked_keyObject

Key used in Redis for tracking who an individual blocks.

Returns:

  • the key used in Redis for tracking who an individual blocks or the default of ‘blocked’ if not set.



78
79
80
# File 'lib/amico/configuration.rb', line 78

def blocked_key
  @blocked_key ||= 'blocked'
end

#default_scope_keyObject

Default key used in Redis for tracking scope for the given relationship calls.

Returns:

  • the default key used in Redis for tracking scope for the given relationship calls.



99
100
101
# File 'lib/amico/configuration.rb', line 99

def default_scope_key
  @default_scope_key ||= 'default'
end

#followers_keyObject

Key used in Redis for tracking the followers of an individual.

Returns:

  • the key used in Redis for tracking the followers of an individual or the default of ‘followers’ if not set.



71
72
73
# File 'lib/amico/configuration.rb', line 71

def followers_key
  @followers_key ||= 'followers'
end

#following_keyObject

Key used in Redis for tracking who an individual is following.

Returns:

  • the key used in Redis for tracking who an individual is following or the default of ‘following’ if not set.



64
65
66
# File 'lib/amico/configuration.rb', line 64

def following_key
  @following_key ||= 'following'
end

#namespaceObject

Amico namespace for Redis.

Returns:

  • the Amico namespace or the default of ‘amico’ if not set.



57
58
59
# File 'lib/amico/configuration.rb', line 57

def namespace
  @namespace ||= 'amico'
end

#page_sizeObject

Page size to be used when paging through the various types of relationships.

Returns:

  • the page size to be used when paging through the various types of relationships or the default of 25 if not set.



113
114
115
# File 'lib/amico/configuration.rb', line 113

def page_size
  @page_size ||= 25
end

#pending_followObject

Key used to indicate whether or not a follow should be pending or not.

Returns:

  • the key used to indicate whether or not a follow should be pending or not.



106
107
108
# File 'lib/amico/configuration.rb', line 106

def pending_follow
  @pending_follow ||= false
end

#pending_keyObject

Key used in Redis for tracking pending follow relationships for an individual.

Returns:

  • the key used in Redis for tracking pending follow relationships for an individual.



92
93
94
# File 'lib/amico/configuration.rb', line 92

def pending_key
  @pending_key ||= 'pending'
end

#reciprocated_keyObject

Key used in Redis for tracking who has reciprocated a follow for an individual.

Returns:

  • the key used in Redis for tracking who has reciprocated a follow for an individual or the default of ‘reciprocated’ if not set.



85
86
87
# File 'lib/amico/configuration.rb', line 85

def reciprocated_key
  @reciprocated_key ||= 'reciprocated'
end

#redisObject

Redis instance.



5
6
7
# File 'lib/amico/configuration.rb', line 5

def redis
  @redis
end

Instance Method Details

#configure {|_self| ... } ⇒ Object

Yield self to be able to configure Amico with block-style configuration.

Example:

Amico.configure do |configuration|
  configuration.redis = Redis.new
  configuration.namespace = 'amico'
  configuration.following_key = 'following'
  configuration.followers_key = 'followers'
  configuration.blocked_key = 'blocked'
  configuration.reciprocated_key = 'reciprocated'
  configuration.pending_key = 'pending'
  configuration.default_scope_key = 'default'
  configuration.pending_follow = false
  configuration.page_size = 25
end

Yields:

  • (_self)

Yield Parameters:



50
51
52
# File 'lib/amico/configuration.rb', line 50

def configure
  yield self
end