Permalink
Browse files

Use Objective-C literals in guides

  • Loading branch information...
1 parent 8dcc514 commit 3f83518ad26df7c80a5f4f6d215ad40f0f5b04d8 @groue committed Aug 22, 2012
Showing with 4 additions and 4 deletions.
  1. +1 −1 Guides/filters.md
  2. +1 −1 Guides/runtime.md
  3. +2 −2 Guides/runtime/booleans.md
View
@@ -121,7 +121,7 @@ Just as you can provide an object hierarchy for rendered values, and extract `pe
id filters = @{
@"math": @{
@"abs": [GRMustacheFilter filterWithBlock:^id(id object) {
- return [NSNumber numberWithInt: abs([object intValue])];
+ return @(abs([object intValue]));
}]
}
};
View
@@ -21,7 +21,7 @@ NSString *templateString = @"I have {{count}} arms.";
NSString *rendering = [GRMustacheTemplate renderObject:dictionary fromString:templateString error:NULL];
```
-1. When GRMustache renders the `{{count}}` tag, it invokes `valueForKey:` with the key `@"count"` on the dictionary. It gets `[NSNumber numberWithInt:2]` as a result.
+1. When GRMustache renders the `{{count}}` tag, it invokes `valueForKey:` with the key `@"count"` on the dictionary. It gets an NSNumber of value 2 as a result.
2. The `description` method of the NSNumber returns a string: `@"2"`.
3. This string is inserted into the rendering: `@"I have 2 arms"`.
@@ -8,9 +8,9 @@ Mustache sections can be controlled by booleans. For instance, the following tem
We'll first talk about some simple cases. We'll then discuss caveats.
-## Simple booleans: [NSNumber numberWithBool:]
+## Simple booleans
-The simplest way to provide booleans to GRMustache is to provide objects returned by the `[NSNumber numberWithBool:]` method:
+The simplest way to provide booleans to GRMustache is to provide `@YES` or `@NO`, that is to say objects returned by the `[NSNumber numberWithBool:]` method:
```objc
NSString *templateString = @"{{#pretty}}whistle{{/pretty}}";

0 comments on commit 3f83518

Please sign in to comment.