2016-04-19 20:02:28 +00:00
|
|
|
package yaml
|
2016-04-11 18:15:53 +00:00
|
|
|
|
2016-05-10 05:57:57 +00:00
|
|
|
import "gopkg.in/yaml.v2"
|
2016-04-11 18:15:53 +00:00
|
|
|
|
|
|
|
// 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
|
2016-04-11 18:15:53 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
// ParseBranchString parses the branch section of the Yaml document.
|
2016-05-10 05:57:57 +00:00
|
|
|
func ParseBranchString(in string) Constraint {
|
2016-04-11 18:15:53 +00:00
|
|
|
return ParseBranch([]byte(in))
|
|
|
|
}
|