Class: Array
Instance Method Summary collapse
Instance Method Details
#ostructify ⇒ Object
18 19 20 |
# File 'lib/tworgy/hash_and_array_extensions.rb', line 18 def ostructify collect { |i| (i.is_a?(Hash) || i.is_a?(Array)) ? i.ostructify : i } end |
#recursively(&block) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/tworgy/hash_and_array_extensions.rb', line 4 def recursively(&block) map do |item| if item.is_a?(self.class) item.recursively(&block) else yield item end end end |
#recursively!(&block) ⇒ Object
14 15 16 |
# File 'lib/tworgy/hash_and_array_extensions.rb', line 14 def recursively!(&block) replace(recursively(&block)) end |