instance method local_constant_names

Ruby on Rails 4.0.13

Since v3.0.20 Last seen in v4.0.13

Available in: v3.0.20 v3.1.12 v3.2.22.5 v4.0.13

Signature

local_constant_names()

DEPRECATED: Use local_constants instead.

Returns the names of the constants defined locally as strings.

module M
  X = 1
end
M.local_constant_names # => ["X"]

This method is useful for forward compatibility, since Ruby 1.8 returns constant names as strings, whereas 1.9 returns them as symbols.

Source
# File activesupport/lib/active_support/core_ext/module/introspection.rb, line 74
  def local_constant_names
    ActiveSupport::Deprecation.warn 'Module#local_constant_names is deprecated, use Module#local_constants instead'
    local_constants.map { |c| c.to_s }
  end

Defined in activesupport/lib/active_support/core_ext/module/introspection.rb line 74 · View on GitHub · Improve this page · Find usages on GitHub

Defined in Module

Type at least 2 characters to search.

↑↓ navigate · open · esc close