Class: GithubConcern::Engine

Inherits:
Rails::Engine
  • Object
show all
Defined in:
lib/github_concern/engine.rb

Constant Summary collapse

@@github_concerns =
{}
@@callback_lambdas =
[]
@@token =
""

Class Method Summary collapse

Class Method Details

.add_callback_lambda(callback_lambda) ⇒ Object



20
21
22
# File 'lib/github_concern/engine.rb', line 20

def self.add_callback_lambda callback_lambda
  @@callback_lambdas << callback_lambda
end

.add_class(class_constant, options) ⇒ Object



12
13
14
# File 'lib/github_concern/engine.rb', line 12

def self.add_class(class_constant, options)
  @@github_concerns[class_constant.to_s] = options
end

.add_github_concernable_relationship_to_class(class_constant) ⇒ Object



64
65
66
67
68
69
# File 'lib/github_concern/engine.rb', line 64

def self.add_github_concernable_relationship_to_class(class_constant)
  class_constant.class_eval {
    has_many :github_concernables, :class_name => "GithubConcernableGitPush", :as => :github_concernable
    has_many :git_pushes, :through => :github_concernables
  }
end

.config {|_self| ... } ⇒ Object

Yields:

  • (_self)

Yield Parameters:



8
9
10
# File 'lib/github_concern/engine.rb', line 8

def self.config
  yield(self)
end

.determine_user(email) ⇒ Object



60
61
62
# File 'lib/github_concern/engine.rb', line 60

def self.determine_user(email)
  @@user_lambda.call(email)
end

.github_concernsObject



16
17
18
# File 'lib/github_concern/engine.rb', line 16

def self.github_concerns
  @@github_concerns
end

.tokenObject



34
35
36
# File 'lib/github_concern/engine.rb', line 34

def self.token
  @@token
end

.token=(_token) ⇒ Object



30
31
32
# File 'lib/github_concern/engine.rb', line 30

def self.token= _token
  @@token = _token
end

.trigger_callback_lambdas(git_push) ⇒ Object



24
25
26
27
28
# File 'lib/github_concern/engine.rb', line 24

def self.trigger_callback_lambdas git_push
  @@callback_lambdas.each do |callback_lambda|
    callback_lambda.call(git_push)
  end
end

.user_classObject



52
53
54
# File 'lib/github_concern/engine.rb', line 52

def self.user_class
  @@user_class
end

.user_class=(user_class_constant) ⇒ Object



46
47
48
49
50
# File 'lib/github_concern/engine.rb', line 46

def self.user_class= user_class_constant
  @@user_class= user_class_constant
  @@user_class.class_eval { has_many :git_pushes }
  @@user_class
end

.user_class_symbolObject



56
57
58
# File 'lib/github_concern/engine.rb', line 56

def self.user_class_symbol
  @@user_class.try(:to_s).try(:downcase).try(:to_sym)
end

.user_lambdaObject



42
43
44
# File 'lib/github_concern/engine.rb', line 42

def self.user_lambda
  @@user_lambda
end

.user_lambda=(find_user_lambda) ⇒ Object



38
39
40
# File 'lib/github_concern/engine.rb', line 38

def self.user_lambda= find_user_lambda
  @@user_lambda = find_user_lambda
end