Class: Blanket::Writer

Inherits:
Object
  • Object
show all
Defined in:
lib/blanket/config/writer.rb

Instance Method Summary collapse

Constructor Details

#initialize(attributes) ⇒ Writer

Returns a new instance of Writer.



3
4
5
# File 'lib/blanket/config/writer.rb', line 3

def initialize(attributes)
  @attributes = attributes
end

Instance Method Details

#write(path) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/blanket/config/writer.rb', line 7

def write(path)
  File.delete(path) if File.exist?(path)
  write_to = File.new(path, File::CREAT, 0644)
  File.open(path, "w") do |out|
    YAML.dump(@attributes, out)
  end
end