Sha256: f4288fd5f87ded552a31319eb8f30908b956f4c6f10a7e4029c046bdfccbbb63

Contents?: true

Size: 480 Bytes

Versions: 10

Compression:

Stored size: 480 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_json }
    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

10 entries across 10 versions & 1 rubygems

Version Path
fiveruns-dash-ruby-0.7.0 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.1 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.2 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.3 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.4 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.5 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.7.6 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.0 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.1 lib/fiveruns/dash/store/file.rb
fiveruns-dash-ruby-0.8.3 lib/fiveruns/dash/store/file.rb