Exception: FakeS3::FakeS3Exception

Inherits:
RuntimeError
  • Object
show all
Defined in:
lib/fakes3/errors.rb

Direct Known Subclasses

BucketNotEmpty, NoSuchBucket

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#request_idObject

Returns the value of attribute request_id.



3
4
5
# File 'lib/fakes3/errors.rb', line 3

def request_id
  @request_id
end

#resourceObject

Returns the value of attribute resource.



3
4
5
# File 'lib/fakes3/errors.rb', line 3

def resource
  @resource
end

Class Method Details

.metaclassObject



5
# File 'lib/fakes3/errors.rb', line 5

def self.metaclass; class << self; self; end; end

.traits(*arr) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/fakes3/errors.rb', line 7

def self.traits(*arr)
  return @traits if arr.empty?
  attr_accessor *arr

  arr.each do |a|
    metaclass.instance_eval do
      define_method( a ) do |val|
        @traits ||= {}
        @traits[a] = val
      end
    end
  end

  class_eval do
    define_method( :initialize ) do
      self.class.traits.each do |k,v|
        instance_variable_set("@#{k}", v)
      end
    end
  end
end

Instance Method Details

#codeObject



31
32
33
# File 'lib/fakes3/errors.rb', line 31

def code
  self.class.to_s
end