class Ccp::Fixtures::Writers::Base

Public Class Methods

[]=(path, hash) click to toggle source
# File lib/ccp/fixtures/writers.rb, line 5
def self.[]= (path, hash)
  new(hash,path).execute
end
new(hash, path) click to toggle source
# File lib/ccp/fixtures/writers.rb, line 9
def initialize(hash, path)
  @hash = hash.must(Hash)
  @path = path.must(Pathname)
end

Public Instance Methods

execute() click to toggle source
# File lib/ccp/fixtures/writers.rb, line 23
def execute
  write(serialize(@hash))
end
serialize(data) click to toggle source
# File lib/ccp/fixtures/writers.rb, line 14
def serialize(data)
  data
end
write(data) click to toggle source
# File lib/ccp/fixtures/writers.rb, line 18
def write(data)
  @path.parent.mkpath
  @path.open("w+"){|f| f.print data}
end