woodpecker/yaml/branch.go

19 lines
412 B
Go
Raw Normal View History

2016-04-19 20:02:28 +00:00
package yaml
2016-05-10 05:57:57 +00:00
import "gopkg.in/yaml.v2"
// ParseBranch parses the branch section of the Yaml document.
2016-05-10 05:57:57 +00:00
func ParseBranch(in []byte) Constraint {
out := struct {
Constraint Constraint `yaml:"branches"`
}{}
yaml.Unmarshal(in, &out)
return out.Constraint
}
// ParseBranchString parses the branch section of the Yaml document.
2016-05-10 05:57:57 +00:00
func ParseBranchString(in string) Constraint {
return ParseBranch([]byte(in))
}