From 26c0f7ca2dff5bd30906ab51233a547f6e3ccf39 Mon Sep 17 00:00:00 2001 From: Greg Schafer Date: Sat, 14 Sep 2013 14:34:53 -0500 Subject: [PATCH] Fix constructor_destructuring example to alert a defined value --- documentation/coffee/constructor_destructuring.coffee | 2 ++ documentation/index.html.erb | 2 +- documentation/js/constructor_destructuring.js | 6 +++++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/documentation/coffee/constructor_destructuring.coffee b/documentation/coffee/constructor_destructuring.coffee index 53c4b39a..4274282c 100644 --- a/documentation/coffee/constructor_destructuring.coffee +++ b/documentation/coffee/constructor_destructuring.coffee @@ -2,3 +2,5 @@ class Person constructor: (options) -> {@name, @age, @height} = options +tim = new Person age: 4 + diff --git a/documentation/index.html.erb b/documentation/index.html.erb index c6d9fb9f..d905e68b 100644 --- a/documentation/index.html.erb +++ b/documentation/index.html.erb @@ -805,7 +805,7 @@ Expressions Destructuring assignment is also useful when combined with class constructors to assign properties to your instance from an options object passed to the constructor.

- <%= code_for('constructor_destructuring', 'contents.join("")') %> + <%= code_for('constructor_destructuring', 'tim.age') %>

diff --git a/documentation/js/constructor_destructuring.js b/documentation/js/constructor_destructuring.js index 13b81030..41a8a1ba 100644 --- a/documentation/js/constructor_destructuring.js +++ b/documentation/js/constructor_destructuring.js @@ -1,5 +1,5 @@ // Generated by CoffeeScript 1.6.3 -var Person; +var Person, tim; Person = (function() { function Person(options) { @@ -9,3 +9,7 @@ Person = (function() { return Person; })(); + +tim = new Person({ + age: 4 +});