API improvements

This commit is contained in:
Alex Yatskov 2015-12-19 21:14:16 +09:00
parent 1029f23558
commit 7f3789a6d4
2 changed files with 7 additions and 4 deletions

View File

@ -107,6 +107,12 @@ func (f *file) Meta() map[string]interface{} {
return f.meta
}
func (f *file) Apply(m map[string]interface{}) {
for key, value := range m {
f.meta[key] = value
}
}
func (f *file) Read(p []byte) (int, error) {
if err := f.cache(); err != nil {
return 0, err

View File

@ -46,13 +46,10 @@ func New(srcDir, dstDir string) Goldsmith {
type File interface {
Path() string
Rename(path string)
Meta() map[string]interface{}
Apply(m map[string]interface{})
Read(p []byte) (int, error)
WriteTo(w io.Writer) (int64, error)
Rewrite(data []byte)
}
func NewFileFromData(path string, data []byte) File {