Method: Module#const_missing_from_oss_library
- Defined in:
- lib/aliyun/oss/extensions.rb
#const_missing_from_oss_library(sym) ⇒ Object Also known as: const_missing
Transforms MarcelBucket into
class MarcelBucket < Aliyun::OSS::Bucket
set_current_bucket_to 'marcel'
end
207 208 209 210 211 212 213 214 215 |
# File 'lib/aliyun/oss/extensions.rb', line 207 def const_missing_from_oss_library(sym) if sym.to_s =~ /^(\w+)(Bucket|OSSObject)$/ const = const_set(sym, Class.new(Aliyun::OSS.const_get($2))) const.current_bucket = $1.underscore const else const_missing_not_from_oss_library(sym) end end |