Module: Flocks::Configuration

Included in:
Flocks
Defined in:
lib/flocks/configuration.rb

Overview

Configuration settings for Flocks.

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.



88
89
90
# File 'lib/flocks/configuration.rb', line 88

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.



81
82
83
# File 'lib/flocks/configuration.rb', line 81

def blocked_key
  @blocked_key ||= 'blocked'
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.



74
75
76
# File 'lib/flocks/configuration.rb', line 74

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.



67
68
69
# File 'lib/flocks/configuration.rb', line 67

def following_key
  @following_key ||= 'following'
end

#namespaceObject

Flocks namespace for Redis.

Returns:

  • the Flocks namespace or the default of ‘flocks’ if not set.



60
61
62
# File 'lib/flocks/configuration.rb', line 60

def namespace
  @namespace ||= 'flocks'
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.



102
103
104
# File 'lib/flocks/configuration.rb', line 102

def page_size
  @page_size ||= 25
end

#pending_follow=(value) ⇒ Object (writeonly)

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



32
33
34
# File 'lib/flocks/configuration.rb', line 32

def pending_follow=(value)
  @pending_follow = value
end

#pending_key=(value) ⇒ Object (writeonly)

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



26
27
28
# File 'lib/flocks/configuration.rb', line 26

def pending_key=(value)
  @pending_key = value
end

#pending_with_key=(value) ⇒ Object (writeonly)

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



29
30
31
# File 'lib/flocks/configuration.rb', line 29

def pending_with_key=(value)
  @pending_with_key = value
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.



95
96
97
# File 'lib/flocks/configuration.rb', line 95

def reciprocated_key
  @reciprocated_key ||= 'reciprocated'
end

#redisObject

Redis instance.



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

def redis
  @redis
end

#string_score_percisionObject

Number of characters to be used when scoring a username for indexing in redis

Returns:

  • the scoring percision



109
110
111
# File 'lib/flocks/configuration.rb', line 109

def string_score_percision
  @string_score_percision ||= 5
end

Instance Method Details

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

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

Example:

Flocks.configure do |configuration|
  configuration.redis = Redis.new
  configuration.namespace = 'flocks'
  configuration.following_key = 'following'
  configuration.followers_key = 'followers'
  configuration.blocked_key = 'blocked'
  configuration.blocked_by_key = 'blocked_by'
  configuration.page_size = 25
end

Yields:

  • (_self)

Yield Parameters:



53
54
55
# File 'lib/flocks/configuration.rb', line 53

def configure
  yield self
end