Class: FileStore::Instance

Inherits:
Object
  • Object
show all
Defined in:
lib/file_store/instance.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(meth, *args, &block) ⇒ Object (private)



19
20
21
22
23
24
25
26
# File 'lib/file_store/instance.rb', line 19

def method_missing(meth, *args, &block)
  if provider.respond_to?(meth)
    meth = provider.mocked? ? "mock_#{meth}" : meth
    provider.public_send(meth, *args, &block)
  else
    super
  end
end

Instance Method Details

#configObject



3
4
5
# File 'lib/file_store/instance.rb', line 3

def config
  (@__config ||= Config.new).tap { |config| yield config if block_given? }
end

#providerObject



7
8
9
10
11
# File 'lib/file_store/instance.rb', line 7

def provider
  # Default to the S3 provider. This will be our only provider in the
  # forseeable future.
  @__provider ||= Providers::S3.new(config.to_h)
end