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_by_keyObject

Key used in Redis for tracking who has blocked an individual.

Returns:

  • the key used in Redis for tracking who has blocked an individual or the default of 'blocked_by' if not set.



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

def blocked_by_key
  @blocked_by_key ||= 'blocked_by'
end

#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.



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

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.



121
122
123
# File 'lib/amico/configuration.rb', line 121

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.



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

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.



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

def following_key
  @following_key ||= 'following'
end

#namespaceObject

Amico namespace for Redis.

Returns:

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



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

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.



135
136
137
# File 'lib/amico/configuration.rb', line 135

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.



128
129
130
# File 'lib/amico/configuration.rb', line 128

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.



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

def pending_key
  @pending_key ||= 'pending'
end

#pending_with_keyObject

Key used in Redis for tracking who an individual is awaiting approval from.

Returns:

  • the key used in Redis for tracking who an individual is awaiting approval from or the default of 'pending_with' if not set.



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

def pending_with_key
  @pending_with_key ||= 'pending_with'
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.



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

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.blocked_by_key = 'blocked_by'
  configuration.reciprocated_key = 'reciprocated'
  configuration.pending_key = 'pending'
  configuration.pending_with_key = 'pending_with'
  configuration.default_scope_key = 'default'
  configuration.pending_follow = false
  configuration.page_size = 25
end

Yields:

  • (_self)

Yield Parameters:



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

def configure
  yield self
end