Class: Aliyun::OSS::FindResponseClass

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun/oss/response.rb

Overview

Guess response class name from current class name. If the guessed response class doesn’t exist do the same thing to the current class’s parent class, up the inheritance heirarchy until either a response class is found or until we get to the top of the heirarchy in which case we just use the the Base response class.

Important: This implemantation assumes that the Base class has a corresponding Base::Response.

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(start) ⇒ FindResponseClass

Returns a new instance of FindResponseClass.



141
142
143
144
# File 'lib/aliyun/oss/response.rb', line 141

def initialize(start)
  @container     = Aliyun::OSS
  @current_class = start
end

Class Method Details

.for(start) ⇒ Object



136
137
138
# File 'lib/aliyun/oss/response.rb', line 136

def for(start)
  new(start).find
end

Instance Method Details

#findObject



146
147
148
149
# File 'lib/aliyun/oss/response.rb', line 146

def find
  self.current_class = current_class.superclass until response_class_found?            
  target.const_get(class_to_find)
end