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



42
43
44
# File 'lib/pippi/checks/select_followed_by_first.rb', line 42

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

#instead_useObject



50
51
52
# File 'lib/pippi/checks/select_followed_by_first.rb', line 50

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

#sampleObject



46
47
48
# File 'lib/pippi/checks/select_followed_by_first.rb', line 46

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