@@ -445,32 +445,34 @@ end
445445
446446## Reusable Responses with Entities
447447
448- Entities are a simple and reusable means for converting Ruby objects to API responses.
448+ Entities are a reusable means for converting Ruby objects to API responses.
449449Entities can be used to conditionally include fields, nest other entities, and build
450450ever larger responses, using inheritance.
451451
452452### Defining Entities
453453
454- Entities inherit from Grape::Entity, and define a simple DSL. The ` #expose ` method can be called in
455- a number of ways. When processing options passed to exposures two keys will always be defined, : version
456- and : collection . The : version key is define as api.version. The : collection key is boolean, and defined
457- as true if the object presented is an array.
454+ Entities inherit from Grape::Entity, and define a simple DSL. Exposures can use
455+ runtime options to determine which fields should be visible, these options are
456+ available to : if , : unless , and : proc . The option keys : version and : collection
457+ will always be defined. The : version key is defined as api.version. The
458+ : collection key is boolean, and defined as true if the object presented is an
459+ array.
458460
459- * expose SYMBOLS
461+ * ` expose SYMBOLS `
460462 * define a list of fields which will always be exposed
461- * expose SYMBOLS, HASH
463+ * ` expose SYMBOLS, HASH `
462464 * HASH keys include : if , : unless , : proc , : as , : using , : format_with , : documentation
463465 * : if and : unless accept hashes (passed during runtime) or procs (arguments are object and options)
464- * expose SYMBOL, {: format_with => : formatter }
466+ * ` expose SYMBOL, {:format_with => :formatter} `
465467 * expose a value, formatting it first
466- * ` :format_with ` can only be applied to one exposure at a time
467- * expose SYMBOL, {: as => "alias"}
468+ * : format_with can only be applied to one exposure at a time
469+ * ` expose SYMBOL, {:as => "alias"} `
468470 * Expose a value, changing its hash key from SYMBOL to alias
469- * ` :as ` can only be applied to one exposure at a time
470- * expose SYMBOL BLOCK
471+ * : as can only be applied to one exposure at a time
472+ * ` expose SYMBOL BLOCK `
471473 * block arguments are object and options
472474 * expose the value returned by the block
473- * ` block ` can only be applied to one exposure at a time
475+ * block can only be applied to one exposure at a time
474476
475477``` ruby
476478module API
0 commit comments