Class: Queuel::AWSConstantFinder

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/queuel/aws_constant_finder.rb

Constant Summary collapse

AWSSDKMissingError =
Class.new(StandardError)

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(klass_name) ⇒ AWSConstantFinder

Returns a new instance of AWSConstantFinder.



14
15
16
# File 'lib/queuel/aws_constant_finder.rb', line 14

def initialize(klass_name)
  @klass_name = klass_name.to_s.upcase
end

Instance Attribute Details

#klass_nameObject (readonly)

Returns the value of attribute klass_name.



12
13
14
# File 'lib/queuel/aws_constant_finder.rb', line 12

def klass_name
  @klass_name
end

Class Method Details

.find(*args) ⇒ Object



8
9
10
# File 'lib/queuel/aws_constant_finder.rb', line 8

def self.find(*args)
  new(*args).find
end

Instance Method Details

#findObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/queuel/aws_constant_finder.rb', line 18

def find
  return fetch_const if fetch_const

  logger.info "Loading AWS SDK..."
  fetch_sdk "aws-sdk" do
    return fetch_const if supported_version?
  end

  fetch_sdk 'aws-sdk-v1' do
    return fetch_const
  end

  fail!
end