Sha256: 0ca11161dc636cf3dfef6b52cdf44627d6875b6000b81bf6f6ab6d26cf11e8ee

Contents?: true

Size: 378 Bytes

Versions: 2

Compression:

Stored size: 378 Bytes

Contents

class Exercism
  class Stash

  	attr_reader :code, :filename

  	def self.save(body)
  	  new(body).save
  	end

  	def initialize(body)
  	  @code = body['code']
      @filename = body['filename']
  	end

  	def save
  	  File.open path, 'w' do |f|
  	  	f.write code
  	  end
  	  self
  	end

    private

  	def path
  	  File.join(FileUtils.pwd, filename)
  	end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
exercism-0.0.28 lib/exercism/stash.rb
exercism-0.0.27 lib/exercism/stash.rb