Class: Array
Class Method Summary collapse
Class Method Details
.wrap(x) ⇒ Object
2 3 4 5 |
# File 'lib/readable-cpp/nodes.rb', line 2 def self.wrap x x.is_a?(Array) ? x : x.is_a?(Hash) ? [x] : [*x] end |
.wrap_nil(x, nil_value = nil) ⇒ Object
6 7 8 |
# File 'lib/readable-cpp/nodes.rb', line 6 def self.wrap_nil x, nil_value = nil (x.nil? || x.respond_to?(:empty) && x.empty?) ? nil_value : wrap(x) end |