Class: Class
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(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym} @@#{sym} end def #{sym} @@#{sym} end EOS end end |
#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(<<-EOS, __FILE__, __LINE__) unless defined? @@#{sym} @@#{sym} = nil end def self.#{sym}=(obj) @@#{sym} = obj end def #{sym}=(obj) @@#{sym} = obj end EOS end end |