Skip to content

Commit

Permalink
fix typo
Browse files Browse the repository at this point in the history
Signed-off-by: Maxime Song <[email protected]>
  • Loading branch information
maximesong committed Jun 26, 2017
1 parent 2b34719 commit 334dcd7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tick/eval.go
Original file line number Diff line number Diff line change
Expand Up @@ -795,14 +795,14 @@ func (r *ReflectionDescriber) Desc() string {
// Using reflection check if the object has the method or field.
// A field is a valid method because we can set it via reflection too.
func (r *ReflectionDescriber) HasChainMethod(name string) bool {
name = capilatizeFirst(name)
name = capitalizeFirst(name)
_, ok := r.chainMethods[name]
return ok
}

func (r *ReflectionDescriber) CallChainMethod(name string, args ...interface{}) (interface{}, error) {
// Check for a method and call it
name = capilatizeFirst(name)
name = capitalizeFirst(name)
if method, ok := r.chainMethods[name]; ok {
return callMethodReflection(method, args)
}
Expand All @@ -811,7 +811,7 @@ func (r *ReflectionDescriber) CallChainMethod(name string, args ...interface{})

// Using reflection check if the object has a field with the property name.
func (r *ReflectionDescriber) HasProperty(name string) bool {
name = capilatizeFirst(name)
name = capitalizeFirst(name)
_, ok := r.propertyMethods[name]
if ok {
return ok
Expand All @@ -822,13 +822,13 @@ func (r *ReflectionDescriber) HasProperty(name string) bool {

func (r *ReflectionDescriber) Property(name string) interface{} {
// Properties set by property methods cannot be read
name = capilatizeFirst(name)
name = capitalizeFirst(name)
property := r.properties[name]
return property.Interface()
}

func (r *ReflectionDescriber) SetProperty(name string, values ...interface{}) (interface{}, error) {
name = capilatizeFirst(name)
name = capitalizeFirst(name)
propertyMethod, ok := r.propertyMethods[name]
if ok {
return callMethodReflection(propertyMethod, values)
Expand Down Expand Up @@ -869,8 +869,8 @@ func callMethodReflection(method reflect.Value, args []interface{}) (interface{}
return nil, fmt.Errorf("function must return a single value or (interface{}, error)")
}

// Capilatizes the first rune in the string
func capilatizeFirst(s string) string {
// Capitalizes the first rune in the string
func capitalizeFirst(s string) string {
r, n := utf8.DecodeRuneInString(s)
s = string(unicode.ToUpper(r)) + s[n:]
return s
Expand Down

0 comments on commit 334dcd7

Please sign in to comment.