Class: RailsLens::Parsers::ClassInfo

Inherits:
NodeInfo
  • Object
show all
Defined in:
lib/rails_lens/parsers/class_info.rb

Instance Attribute Summary

Attributes inherited from NodeInfo

#column, #end_line, #line_number, #name, #namespace

Instance Method Summary collapse

Methods inherited from NodeInfo

#full_name, #initialize, #inspect, #to_s

Constructor Details

This class inherits a constructor from RailsLens::Parsers::NodeInfo

Instance Method Details

#matches?(class_name) ⇒ Boolean

Returns:

  • (Boolean)


6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/rails_lens/parsers/class_info.rb', line 6

def matches?(class_name)
  class_name_str = class_name.to_s

  # Exact matches
  return true if name == class_name_str
  return true if full_name == class_name_str

  # Handle simple name match only if no namespace specified in query
  return true if class_name_str.exclude?('::') && (name == class_name_str)

  false
end