Sha256: 9b473091ffd92ad45f32f41146de224df2d82a3ee14cc4694befe8a07f9ba438

Contents?: true

Size: 407 Bytes

Versions: 20

Compression:

Stored size: 407 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

20 entries across 20 versions & 1 rubygems

Version Path
tracksperanto-2.8.6 lib/tracksperanto/const_name.rb
tracksperanto-2.8.5 lib/tracksperanto/const_name.rb
tracksperanto-2.8.4 lib/tracksperanto/const_name.rb
tracksperanto-2.8.2 lib/tracksperanto/const_name.rb
tracksperanto-2.8.1 lib/tracksperanto/const_name.rb
tracksperanto-2.8.0 lib/tracksperanto/const_name.rb
tracksperanto-2.7.0 lib/tracksperanto/const_name.rb
tracksperanto-2.6.3 lib/tracksperanto/const_name.rb
tracksperanto-2.6.2 lib/tracksperanto/const_name.rb
tracksperanto-2.6.1 lib/tracksperanto/const_name.rb
tracksperanto-2.6.0 lib/tracksperanto/const_name.rb
tracksperanto-2.5.0 lib/tracksperanto/const_name.rb
tracksperanto-2.4.1 lib/tracksperanto/const_name.rb
tracksperanto-2.3.3 lib/tracksperanto/const_name.rb
tracksperanto-2.3.2 lib/tracksperanto/const_name.rb
tracksperanto-2.3.1 lib/tracksperanto/const_name.rb
tracksperanto-2.3.0 lib/tracksperanto/const_name.rb
tracksperanto-2.2.4 lib/tracksperanto/const_name.rb
tracksperanto-2.2.2 lib/tracksperanto/const_name.rb
tracksperanto-2.2.0 lib/tracksperanto/const_name.rb