Module: Jat::JatClass

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#jat_classObject

Returns the Jat class that this class is namespaced under.



6
7
8
# File 'lib/jat/utils/jat_class.rb', line 6

def jat_class
  @jat_class
end

Instance Method Details

#inspectObject

Since class that uses current module is anonymously subclassed when Jat is subclassed, and then assigned to a constant of the Jat subclass, make inspect reflect the likely name for the class.



11
12
13
14
15
16
17
18
19
# File 'lib/jat/utils/jat_class.rb', line 11

def inspect
  return super unless jat_class

  path = superclass.inspect
  index = path.rindex("::") + 2
  class_name = path[index, path.length - index]

  "#{jat_class.inspect}::#{class_name}"
end