LoadExtensionsForPath for returns extensions for specific path
(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string)
| 45 | |
| 46 | //LoadExtensionsForPath for returns extensions for specific path |
| 47 | func (env *Environment) LoadExtensionsForPath(extensions []*schema.Extension, timeLimit time.Duration, timeLimits []*schema.PathEventTimeLimit, path string) error { |
| 48 | var err error |
| 49 | for _, extension := range extensions { |
| 50 | if extension.Match(path) { |
| 51 | if extension.CodeType != "gohanscript" { |
| 52 | continue |
| 53 | } |
| 54 | |
| 55 | err = env.VM.LoadString(extension.File, extension.Code) |
| 56 | if err != nil { |
| 57 | log.Fatalf("%s", err) |
| 58 | return err |
| 59 | } |
| 60 | |
| 61 | } |
| 62 | } |
| 63 | // setup time limits for matching extensions |
| 64 | env.timeLimit = timeLimit |
| 65 | for _, timeLimit := range timeLimits { |
| 66 | if timeLimit.Match(path) { |
| 67 | env.timeLimits = append(env.timeLimits, schema.NewEventTimeLimit(timeLimit.EventRegex, timeLimit.TimeDuration)) |
| 68 | } |
| 69 | } |
| 70 | return nil |
| 71 | } |
| 72 | |
| 73 | //HandleEvent handles event |
| 74 | func (env *Environment) HandleEvent(event string, context map[string]interface{}) (err error) { |
nothing calls this directly
no test coverage detected