class ResoTransport::MetadataCache

Attributes

name[R]

Public Class Methods

new(name) click to toggle source
# File lib/reso_transport/metadata_cache.rb, line 5
def initialize(name)
  @name = name
end

Public Instance Methods

read() click to toggle source
# File lib/reso_transport/metadata_cache.rb, line 9
def read
  return nil if !File.exist?(name) || File.size(name).zero?

  File.new(name)
end
write(raw) click to toggle source
# File lib/reso_transport/metadata_cache.rb, line 15
def write(raw)
  File.open(name, 'w') { |f| f.write(raw.force_encoding('UTF-8')) } if raw.length.positive?
  File.new(name)
end