This commit is contained in:
Rico Sta. Cruz 2014-05-07 16:12:54 +08:00
parent 766a985575
commit 8c124682c9
2 changed files with 27 additions and 2 deletions

View File

@ -16,10 +16,10 @@ layout: default
The `coverage` task injects your source files (`lib`) with jscoverage hooks, runs `mocha -R html-cov`, then restores later.
/* directory */
"coverage": "mv lib lib~; (./node_modules/.bin/jscoverage lib~ lib; ./node_modules/.bin/mocha -R html-cov > coverage.html); rm -rf lib; mv lib~ lib"
"coverage": "mv lib lib~; (jscoverage lib~ lib; mocha -R html-cov > coverage.html); rm -rf lib; mv lib~ lib"
/* single file */
"coverage": "(cp index.js index.js~; ./node_modules/.bin/jscoverage index.js; mv index-cov.js index.js; ./node_modules/.bin/mocha -R html-cov > coverage.html); mv index.js~ index.js"
"coverage": "(cp index.js index.js~; jscoverage index.js; mv index-cov.js index.js; mocha -R html-cov > coverage.html); mv index.js~ index.js"
### Run

25
ruby21.md Normal file
View File

@ -0,0 +1,25 @@
---
title: Ruby 2.1
layout: default
---
### Named arguments with defaults
# length is required
def pad(num, length:, char: "0")
num.to_s.rjust(length, char)
end
pad(42, length: 6) #=> "000042"
pad(42) #=> #<ArgumentError: missing keyword: length>
### Module.prepend
prepend(Module.new do
define_method ...
end)
### References
* http://globaldev.co.uk/2013/03/ruby-2-0-0-in-detail
* http://globaldev.co.uk/2014/05/ruby-2-1-in-detail