Class: Pippi::Checks::MapFollowedByFlatten::Documentation
- Inherits:
-
Object
- Object
- Pippi::Checks::MapFollowedByFlatten::Documentation
- Defined in:
- lib/pippi/checks/map_followed_by_flatten.rb
Instance Method Summary collapse
Instance Method Details
#description ⇒ Object
45 46 47 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 45 def description "Don't use map followed by flatten(1); use flat_map instead" end |
#instead_use ⇒ Object
53 54 55 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 53 def instead_use '[1,2,3].flat_map {|x| [x, x+1]}' end |
#sample ⇒ Object
49 50 51 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 49 def sample '[1,2,3].map {|x| [x,x+1] }.flatten(1)' end |