Class: Hash
- Inherits:
-
Object
show all
- Defined in:
- lib/appswarm/tools.rb
Instance Method Summary
collapse
Instance Method Details
#map_to_a(&b) ⇒ Object
187
188
189
190
191
192
193
|
# File 'lib/appswarm/tools.rb', line 187
def map_to_a(&b)
h=[]
self.each{|k,v|
h << b.call(k,v)
}
h
end
|
#map_to_h(&b) ⇒ Object
180
181
182
183
184
185
186
|
# File 'lib/appswarm/tools.rb', line 180
def map_to_h(&b)
h={}
self.each{|k,v|
h[k]=b.call(k,v)
}
h
end
|
#select(&b) ⇒ Object
195
196
197
198
199
200
201
202
203
|
# File 'lib/appswarm/tools.rb', line 195
def select(&b)
h={}
self.each{|k,v|
if b.call(k,v)
h[k]=v
end
}
h
end
|
#select_to_a ⇒ Object
194
|
# File 'lib/appswarm/tools.rb', line 194
alias :select_to_a :select
|