Method: WhatTheGem::Usage::Extractor::CodeBlock#ruby?

Defined in:
lib/whatthegem/usage/extractor.rb

#ruby?Boolean

Returns:

  • (Boolean)


35
36
37
38
39
40
41
42
43
# File 'lib/whatthegem/usage/extractor.rb', line 35

def ruby?
  # Ripper returns nil for anything but correct Ruby
  #
  # TODO: Unfortunately, Ripper is fixed to current version syntax, so trying this trick on
  # Ruby 2.4 with something that uses Ruby 2.7 features will unhelpfully return "no, not Ruby"
  #
  # Maybe trying parser gem could lead to the same effect
  !Ripper.sexp(body).nil?
end