// UnmarshalYAML implements yaml.v2 Unmarshaler interface.
UnmarshalYAML implements yaml.v2 Unmarshaler interface.
// UnmarshalYAML implements yaml . v2 Unmarshaler interface .
func (r *QuoteConsistentOption) UnmarshalYAML(unmarshal func(interface{}) error) error {
	var option struct {
		Quote string `yaml:"quote"`
	}
	if err := unmarshal(&option); err != nil {
		return err
	}
	if 0 < len(option.Quote) {
		supportQuotes := map[string]QuoteType{
			"double": DoubleQuote,
			"single": SingleQuote,
		}
		quote, ok := supportQuotes[option.Quote]
		if !ok {
			var list []string
			for k := range supportQuotes {
				list = append(list, k)
			}
			return fmt.Errorf("%s is an invalid quote. valid options are [%s]",
				option.Quote, strings.Join(list, ","))
		}
		r.Quote = quote
	}
	return nil
}
func ( r * QuoteConsistentOption ) UnmarshalYAML ( unmarshal func ( interface { } ) error ) error { var option struct { Quote string `yaml:"quote"` } if err := unmarshal ( & option ) ; err != nil { return err } if 0 < len ( option . Quote ) { supportQuotes := map [ string ] QuoteType { " " : DoubleQuote , " " : SingleQuote , } quote , ok := supportQuotes [ option . Quote ] if ! ok { var list [ ] string for k := range supportQuotes { list = append ( list , k ) } return fmt . Errorf ( " " , option . Quote , strings . Join ( list , " " ) ) } r . Quote = quote } return nil }
UnmarshalYAML implements yaml.v2 Unmarshaler interface.
UnmarshalYAML implements yaml . v2 Unmarshaler interface .