Class: Class

Inherits:
Object show all
Defined in:
lib/aws/s3/extensions.rb

Overview

:nodoc:

Instance Method Summary collapse

Instance Method Details

#cattr_accessor(*syms) ⇒ Object



257
258
259
260
# File 'lib/aws/s3/extensions.rb', line 257

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

#cattr_reader(*syms) ⇒ Object



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

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



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

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