module Flydata module PluginSupport class SourcePositionFile attr_accessor :path def initialize(path) @path = path end def exists? File.exists?(@path) end def read File.open(@path) {|f| f.read } end def pos if exists? self.class::SOURCE_POS_CLASS.load(read) else nil end end def save(*args) c = self.class::SOURCE_POS_CLASS.new(*args) File.open(@path, 'w') {|f| f.write(c.to_s) } c end end end end