Remove warnings "instance variable @{ivar} not initialized"

This commit is contained in:
Kenichi Kamiya 2013-01-11 02:13:52 +09:00 committed by Erik Michaels-Ober
parent 4364add1c4
commit 960c2a4913
3 changed files with 9 additions and 3 deletions

View File

@ -3,6 +3,7 @@ require 'omniauth'
module OmniAuth
class Builder < ::Rack::Builder
def initialize(app, &block)
@options = nil
if rack14?
super
else

View File

@ -95,6 +95,7 @@ module OmniAuth
@html = ""
@with_custom_button = false
@footer = nil
header(options[:title],options[:header_info])
end

View File

@ -22,7 +22,7 @@ module OmniAuth
# Returns an inherited set of default options set at the class-level
# for each strategy.
def default_options
return @default_options if @default_options
return @default_options if instance_variable_defined?(:@default_options) && @default_options
existing = superclass.respond_to?(:default_options) ? superclass.default_options : {}
@default_options = OmniAuth::Strategy::Options.new(existing)
end
@ -77,9 +77,12 @@ module OmniAuth
# recorded as. This takes care of 90% of the use cases for overriding
# the initializer in OmniAuth Strategies.
def args(args = nil)
@args = Array(args) and return if args
if args
@args = Array(args)
return
end
existing = superclass.respond_to?(:args) ? superclass.args : []
return @args || existing
return (instance_variable_defined?(:@args) && @args) || existing
end
%w(uid info extra credentials).each do |fetcher|
@ -123,6 +126,7 @@ module OmniAuth
# @yield [Options] Yields options to block for further configuration.
def initialize(app, *args, &block)
@app = app
@env = nil
@options = self.class.default_options.dup
options.deep_merge!(args.pop) if args.last.is_a?(Hash)