From 7f3789a6d427bdd5d13a02316fdef540fd08a1c3 Mon Sep 17 00:00:00 2001 From: Alex Yatskov Date: Sat, 19 Dec 2015 21:14:16 +0900 Subject: [PATCH] API improvements --- file.go | 6 ++++++ types.go | 5 +---- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/file.go b/file.go index 65d82f9..15b502b 100644 --- a/file.go +++ b/file.go @@ -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 diff --git a/types.go b/types.go index e003efa..6008515 100644 --- a/types.go +++ b/types.go @@ -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 {