Method: Oboe::Util.contextual_name

Defined in:
lib/oboe/util.rb

.contextual_name(cls) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/oboe/util.rb', line 10

def contextual_name(cls)
  # Attempt to infer a contextual name if not indicated
  #
  # For example:
  # ::ActiveRecord::ConnectionAdapters::AbstractMysqlAdapter.to_s.split(/::/).last
  # => "AbstractMysqlAdapter"
  #
  cls.to_s.split(/::/).last
rescue
  cls
end