summaryrefslogtreecommitdiffstats
path: root/vendor/github.com/gobwas/glob/match/suffix.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/gobwas/glob/match/suffix.go')
-rw-r--r--vendor/github.com/gobwas/glob/match/suffix.go35
1 files changed, 35 insertions, 0 deletions
diff --git a/vendor/github.com/gobwas/glob/match/suffix.go b/vendor/github.com/gobwas/glob/match/suffix.go
new file mode 100644
index 000000000..85bea8c68
--- /dev/null
+++ b/vendor/github.com/gobwas/glob/match/suffix.go
@@ -0,0 +1,35 @@
+package match
+
+import (
+ "fmt"
+ "strings"
+)
+
+type Suffix struct {
+ Suffix string
+}
+
+func NewSuffix(s string) Suffix {
+ return Suffix{s}
+}
+
+func (self Suffix) Len() int {
+ return lenNo
+}
+
+func (self Suffix) Match(s string) bool {
+ return strings.HasSuffix(s, self.Suffix)
+}
+
+func (self Suffix) Index(s string) (int, []int) {
+ idx := strings.Index(s, self.Suffix)
+ if idx == -1 {
+ return -1, nil
+ }
+
+ return 0, []int{idx + len(self.Suffix)}
+}
+
+func (self Suffix) String() string {
+ return fmt.Sprintf("<suffix:%s>", self.Suffix)
+}