Class: Sprig::Reap::FileAttribute::LocalFile

Inherits:
Struct
  • Object
show all
Defined in:
lib/sprig/reap/file_attribute.rb

Instance Method Summary collapse

Instance Method Details

#fileObject



50
51
52
53
54
55
56
# File 'lib/sprig/reap/file_attribute.rb', line 50

def file
  @file ||= File.open(unique_location, 'w', :encoding => encoding).tap do |file|
    io.rewind
    file.write(io.read)
    io.close
  end
end

#ioObject



58
59
60
# File 'lib/sprig/reap/file_attribute.rb', line 58

def io
  @io ||= open uri
end

#sprig_locationObject



62
63
64
# File 'lib/sprig/reap/file_attribute.rb', line 62

def sprig_location
  "<%= sprig_file('#{File.basename(file.path)}') %>"
end