constants

Module.constants â array
Module.constants(inherited) â array
Class Public methods

In the first form, returns an array of the names of all constants accessible from the point of call. This list includes the names of all modules and classes defined in the global scope.

Module.constants.first(4)
   # => [:ARGF, :ARGV, :ArgumentError, :Array]

Module.constants.include?(:SEEK_SET)   # => false

class IO
  Module.constants.include?(:SEEK_SET) # => true
end

The second form calls the instance method constants.

doc_ruby_on_rails
2015-04-19 01:43:16
Comments
Leave a Comment

Please login to continue.