#encoding: utf-8 module PointRb class PointRbFile attr_accessor :path, :base_dir, :content def initialize(path, content) @path = path @base_dir = '' @content = canonize_string(content) end def full_path if @path =~ /^\// @path else File.join(@base_dir, @path) end end def create File.open(full_path, "wb") do |f| f.write content end end private def canonize_string(str) str.strip_heredoc.gsub(/^\n/, '') end end end