Module: Twimock::OmniAuthTwitter

Extended by:
OmniAuthTwitter
Included in:
OmniAuthTwitter
Defined in:
lib/twimock/omniauth_twitter.rb

Constant Summary collapse

@@enable =
false

Instance Method Summary collapse

Instance Method Details

#offObject



25
26
27
28
29
30
31
32
33
34
# File 'lib/twimock/omniauth_twitter.rb', line 25

def off
  if Twimock::OmniAuthTwitter.on?
    ::OmniAuth::Strategies::Twitter.class_eval do
      alias_method  :request_phase, :__request_phase
      remove_method :__request_phase
    end
    @@enable = false
  end
  true
end

#onObject



13
14
15
16
17
18
19
20
21
22
23
# File 'lib/twimock/omniauth_twitter.rb', line 13

def on
  unless Twimock::OmniAuthTwitter.on?
    ::OmniAuth::Strategies::Twitter.class_eval do
      alias_method  :__request_phase, :request_phase
      remove_method :request_phase
      include Twimock::OmniAuth::Strategies::Twitter
    end
    @@enable = true
  end
  true
end

#on?Boolean

Returns:

  • (Boolean)


9
10
11
# File 'lib/twimock/omniauth_twitter.rb', line 9

def on?
  @@enable
end