Sha256: 42097f582285a9e4e6af9f18cbd1e220116434d70adc592321767c148fd6a531

Contents?: true

Size: 481 Bytes

Versions: 6

Compression:

Stored size: 481 Bytes

Contents

module Fiveruns::Dash::Store
  
  module File
    
    def store_file(*uris)
      uris.each do |uri|
        directory = uri.path
        write_to filename(directory)
      end
    end
    
    def write_to(path)
      ::File.open(path, 'w') { |f| f.write @payload.to_fjson }
    end
    
    def filename(directory)
      kind = payload.class.name =~ /(\w+)Payload/
      name = kind ? $1 : 'unknown'
      ::File.join(directory, "#{guid}.#{name}.json")
    end
    
  end
  
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fiveruns-dash-ruby-0.8.10 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.4 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.5 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.6 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.8 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.9 lib/fiveruns/dash/store/file.rb