Class: Class

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

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cattr_accessor(*syms) ⇒ Object



258
259
260
261
# File 'lib/aliyun/oss/extensions.rb', line 258

def cattr_accessor(*syms)
  cattr_reader(*syms)
  cattr_writer(*syms)
end

#cattr_reader(*syms) ⇒ Object



222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
# File 'lib/aliyun/oss/extensions.rb', line 222

def cattr_reader(*syms)
  syms.flatten.each do |sym|
    class_eval("      unless defined? @@\#{sym}\n        @@\#{sym} = nil\n      end\n\n      def self.\#{sym}\n        @@\#{sym}\n      end\n\n      def \#{sym}\n        @@\#{sym}\n      end\n    EOS\n  end\nend\n", __FILE__, __LINE__)

#cattr_writer(*syms) ⇒ Object



240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
# File 'lib/aliyun/oss/extensions.rb', line 240

def cattr_writer(*syms)
  syms.flatten.each do |sym|
    class_eval("      unless defined? @@\#{sym}\n        @@\#{sym} = nil\n      end\n\n      def self.\#{sym}=(obj)\n        @@\#{sym} = obj\n      end\n\n      def \#{sym}=(obj)\n        @@\#{sym} = obj\n      end\n    EOS\n  end\nend\n", __FILE__, __LINE__)