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
43 44 45 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 43 def description "Don't use map followed by flatten(1); use flat_map instead" end |
#instead_use ⇒ Object
51 52 53 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 51 def instead_use '[1,2,3].flat_map {|x| [x, x+1]}' end |
#sample ⇒ Object
47 48 49 |
# File 'lib/pippi/checks/map_followed_by_flatten.rb', line 47 def sample '[1,2,3].map {|x| [x,x+1] }.flatten(1)' end |