Class: Pippi::Checks::ReverseFollowedByEach::Documentation

Inherits:
Object
  • Object
show all
Defined in:
lib/pippi/checks/reverse_followed_by_each.rb

Instance Method Summary collapse

Instance Method Details

#descriptionObject



37
38
39
# File 'lib/pippi/checks/reverse_followed_by_each.rb', line 37

def description
  "Don't use each followed by reverse; use reverse_each instead"
end

#instead_useObject



45
46
47
# File 'lib/pippi/checks/reverse_followed_by_each.rb', line 45

def instead_use
  '[1,2,3].reverse_each {|x| x+1 }'
end

#sampleObject



41
42
43
# File 'lib/pippi/checks/reverse_followed_by_each.rb', line 41

def sample
  '[1,2,3].reverse.each {|x| x+1 }'
end