Class: Pippi::Checks::SelectFollowedByFirst::Documentation

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



27
28
29
# File 'lib/pippi/checks/select_followed_by_first.rb', line 27

def description
  "Don't use select followed by first; use detect instead"
end

#instead_useObject



35
36
37
# File 'lib/pippi/checks/select_followed_by_first.rb', line 35

def instead_use
  '[1,2,3].detect {|x| x > 1 }'
end

#sampleObject



31
32
33
# File 'lib/pippi/checks/select_followed_by_first.rb', line 31

def sample
  '[1,2,3].select {|x| x > 1 }.first'
end