class XmlConv::Util::DestinationDir

Attributes

filename[R]

Public Class Methods

new(uri = URI.parse('/')) click to toggle source
Calls superclass method XmlConv::Util::Destination::new
# File lib/xmlconv/util/destination.rb, line 62
def initialize(uri = URI.parse('/'))
  @path = uri.path
  super()
end

Public Instance Methods

deliver(delivery) click to toggle source
# File lib/xmlconv/util/destination.rb, line 66
                  def deliver(delivery)
  do_deliver(delivery)
  @status = :pending_pickup
                          odba_store
end
do_deliver(delivery) click to toggle source
# File lib/xmlconv/util/destination.rb, line 71
def do_deliver(delivery)
  if(delivery.is_a?(Array))
    delivery.each { |part| do_deliver(part) }
  else
    FileUtils.mkdir_p(@path)
    @filename = delivery.filename
    path = File.expand_path(sanitize(@filename), @path)
    File.open(path, 'w') { |fh| fh << delivery.to_s }
  end
                  end
update_status() click to toggle source
# File lib/xmlconv/util/destination.rb, line 81
def update_status
        if(@status == :pending_pickup \
                && !File.exist?(File.expand_path(sanitize(@filename), @path)))
                @status = :picked_up
                odba_store
        end
end
uri() click to toggle source
# File lib/xmlconv/util/destination.rb, line 88
def uri
        URI.parse("file:#{File.expand_path(sanitize(@filename), @path)}")
end