第31页 Designing Beautiful APIs
- 章节名:Designing Beautiful APIs
- 页码:第31页
#flatten Method def distance(*args) distance(args.flatten) end [1,2,3,[4]].flatten => [1, 2, 3, 4] #zip method %w[F HS FS HB].zip((0..4).to_a) => [["F", 0], ["HS", 1], ["FS", 2], ["HB", 3]] (0..6).to_a =>[0, 1, 2, 3, 4, 5, 6] [1,2, 3, 4].all? {|x| Numeric=== x} => true [1,2,3,4].all? {|x| x>2} =>false #raise ArgumentError .. foo = Hash.new {|k,v| k[v] = []} #init value tyep. foo[:bid] =>[] ft = Hash.new #doesn't init value type ft[:bid] => nil
32人阅读
天才狐狸对本书的所有笔记 · · · · · ·
-
第31页 Designing Beautiful APIs
-
第72页 Design Beautiful APIs
Server.run do #code block handle(/hello/i) { "Hello form server at #{Time.now}"} #eval...
-
第96页
Proc#arity lamba {|x| x+1}.arity =>1 lamba {|x, y, z| x+1}.arity =>3 lamba {1}.arity =>...
> 查看全部5篇
说明 · · · · · ·
表示其中内容是对原文的摘抄