Module: Charty::Util
- Defined in:
- lib/charty/util.rb
Class Method Summary collapse
Class Method Details
.filter_map(enum, &block) ⇒ Object
4 5 6 7 8 9 10 11 12 13 |
# File 'lib/charty/util.rb', line 4 module_function def filter_map(enum, &block) enum.inject([]) do |acc, x| y = block.call(x) if y acc.push(y) else acc end end end |
.missing?(val) ⇒ Boolean
20 21 22 |
# File 'lib/charty/util.rb', line 20 module_function def missing?(val) val.nil? || nan?(val) end |
.nan?(val) ⇒ Boolean
24 25 26 |
# File 'lib/charty/util.rb', line 24 module_function def nan?(val) val.respond_to?(:nan?) && val.nan? end |