Sha256: bc8020e1383e858c179102c891832e49512272b1082d604c3dba9ee36fa4c7f4

Contents?: true

Size: 726 Bytes

Versions: 5

Compression:

Stored size: 726 Bytes

Contents

require "local_resource/engine"

module LocalResource
  extend self

  # You can add, in this module, your own configuration options as in the example below...
  #
  # attr_writer :my_option
  #
  # def my_option
  #   return "Default Value" unless @my_option
  #   @my_option
  # end
  #
  # Then, you can customize the default behaviour (typically in a Rails initializer) like this:
  #
  # LocalResource.setup do |config|
  #   config.root_url = "Another value"
  # end

  def setup
    yield self
    require "local_resource"
  end

  def as_local_resource(url, tmp_filename, &block)
    instance = LocalResource::Instance.new(url, tmp_filename)
    block.call(instance.file_path)
  ensure
    instance&.destroy
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
local_resource-2.0.0 lib/local_resource.rb
local_resource-1.0.0 lib/local_resource.rb
local_resource-0.2.0 lib/local_resource.rb
local_resource-0.1.1 lib/local_resource.rb
local_resource-0.1.0 lib/local_resource.rb