Class: Aliyun::OSS::Struct::Base
- Inherits:
-
Object
- Object
- Aliyun::OSS::Struct::Base
- Extended by:
- AttrHelper
- Defined in:
- lib/aliyun/oss/struct.rb
Direct Known Subclasses
Bucket, BucketLogging, BucketReferer, BucketWebsite, CORSRule, Config, LifeCycleRule, Multipart::Part, Multipart::Transaction, Object
Defined Under Namespace
Modules: AttrHelper
Instance Method Summary collapse
-
#initialize(opts = {}) ⇒ Base
constructor
A new instance of Base.
- #to_s ⇒ Object
Methods included from AttrHelper
Constructor Details
#initialize(opts = {}) ⇒ Base
Returns a new instance of Base.
83 84 85 86 87 88 89 90 91 92 |
# File 'lib/aliyun/oss/struct.rb', line 83 def initialize(opts = {}) extra_keys = opts.keys - attrs unless extra_keys.empty? fail ClientError, "Unexpected extra keys: #{extra_keys.join(', ')}" end attrs.each do |attr| instance_variable_set("@#{attr}", opts[attr]) end end |
Instance Method Details
#to_s ⇒ Object
94 95 96 97 98 99 |
# File 'lib/aliyun/oss/struct.rb', line 94 def to_s attrs.map do |attr| v = instance_variable_get("@#{attr}") "#{attr.to_s}: #{v}" end.join(", ") end |