Sha256: 23694674b236da1a986b72d7d5b7300484519a4d6af361ff75e0698fe34b5353

Contents?: true

Size: 408 Bytes

Versions: 5

Compression:

Stored size: 408 Bytes

Contents

# Provides const_name that returns the name of the class or module (or the name of the class
# an instance belongs to)  without it's parent namespace. Useful for building module tables
module Tracksperanto::ConstName
  module C
    def const_name
      to_s.split('::').pop
    end
  end
  
  def const_name
    self.class.const_name
  end
  
  def self.included(into)
    into.extend(C)
    super
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
tracksperanto-4.2.0 lib/tracksperanto/const_name.rb
tracksperanto-4.1.3 lib/tracksperanto/const_name.rb
tracksperanto-4.1.2 lib/tracksperanto/const_name.rb
tracksperanto-4.1.0 lib/tracksperanto/const_name.rb
tracksperanto-4.0.0 lib/tracksperanto/const_name.rb