Class: Pippi::Checks::SelectFollowedByAny::Documentation

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

Instance Method Summary collapse

Instance Method Details

#descriptionObject



15
16
17
# File 'lib/pippi/checks/select_followed_by_any.rb', line 15

def description
  "Don't use select followed by any?; use any? with a block instead"
end

#instead_useObject



21
22
23
# File 'lib/pippi/checks/select_followed_by_any.rb', line 21

def instead_use
  "[1,2,3].any? {|x| x > 1 }"
end

#sampleObject



18
19
20
# File 'lib/pippi/checks/select_followed_by_any.rb', line 18

def sample
  "[1,2,3].select {|x| x > 1 }.any?"
end