Rename instantiate to render (#18)
diff --git a/invoke_test.go b/invoke_test.go
index 37f7b0a..ff273d8 100644
--- a/invoke_test.go
+++ b/invoke_test.go
@@ -15,7 +15,7 @@
// initial, max, multiplier
WithDelayTimeoutSettings(100*time.Millisecond, 300*time.Millisecond, 1.5),
WithRPCTimeoutSettings(50*time.Millisecond, 500*time.Millisecond, 3.0),
- WithTimeout(1000*time.Millisecond),
+ WithTimeout(1000 * time.Millisecond),
}
)
diff --git a/path_template.go b/path_template.go
index 7cbf011..41bda94 100644
--- a/path_template.go
+++ b/path_template.go
@@ -152,9 +152,9 @@
return values, nil
}
-// Instantiate creates a path string from its template and the binding from
+// Render creates a path string from its template and the binding from
// the variable name to the value.
-func (pt *PathTemplate) Instantiate(binding map[string]string) (string, error) {
+func (pt *PathTemplate) Render(binding map[string]string) (string, error) {
result := make([]string, 0, len(pt.segments))
var lastVariableName string
for _, segment := range pt.segments {
diff --git a/path_template_test.go b/path_template_test.go
index 09b598f..49dea47 100644
--- a/path_template_test.go
+++ b/path_template_test.go
@@ -31,7 +31,7 @@
import "testing"
-func TestPathTemplateMatchInstantiate(t *testing.T) {
+func TestPathTemplateMatchRender(t *testing.T) {
testCases := []struct {
message string
template string
@@ -100,7 +100,7 @@
if len(values) != 0 {
t.Errorf("[%s] The matched data has unexpected keys: %v", testCase.message, values)
}
- built, err := pt.Instantiate(testCase.values)
+ built, err := pt.Render(testCase.values)
if err != nil || built != testCase.path {
t.Errorf("[%s] Built path '%s' is different from the expected '%s', %v", testCase.message, built, testCase.path, err)
}
@@ -142,8 +142,8 @@
}
}
-func TestPathTemplateInstantiateTooManyValues(t *testing.T) {
- // Test cases where Instantiate() succeeds but Match() doesn't return the same map.
+func TestPathTemplateRenderTooManyValues(t *testing.T) {
+ // Test cases where Render() succeeds but Match() doesn't return the same map.
testCases := []struct {
message string
template string
@@ -163,7 +163,7 @@
t.Errorf("[%s] Failed to parse template %s (error %v)", testCase.message, testCase.template, err)
continue
}
- if result, err := pt.Instantiate(testCase.values); err != nil || result != testCase.expected {
+ if result, err := pt.Render(testCase.values); err != nil || result != testCase.expected {
t.Errorf("[%s] Failed to build the path (expected '%s' but returned '%s'", testCase.message, testCase.expected, result)
}
}