Class: WebMock::Resources::SchemaStorage

Inherits:
Hash
  • Object
show all
Defined in:
lib/webmock-resources/schema_storage.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.instanceObject



4
5
6
# File 'lib/webmock-resources/schema_storage.rb', line 4

def self.instance
  @instance ||= new
end

Instance Method Details

#[](key) ⇒ Object



8
9
10
# File 'lib/webmock-resources/schema_storage.rb', line 8

def [] key
  super(key) || super(key.to_s.pluralize.to_sym)
end

#[]=(resource, schema) ⇒ Object



12
13
14
15
# File 'lib/webmock-resources/schema_storage.rb', line 12

def []= resource, schema
  stub_resource resource
  super resource, schema
end

#reload_index_stubsObject



27
28
29
30
31
# File 'lib/webmock-resources/schema_storage.rb', line 27

def reload_index_stubs
  keys.each do |resource|
    stub_resource resource
  end
end

#reset_sequencesObject



17
18
19
20
21
# File 'lib/webmock-resources/schema_storage.rb', line 17

def reset_sequences
  each_value do |schema|
    schema.reset_sequence
  end
end

#stub_resource(resource) ⇒ Object



23
24
25
# File 'lib/webmock-resources/schema_storage.rb', line 23

def stub_resource resource
  Stubber.instance.stub_index resource
end