Class: String

Inherits:
Object
  • Object
show all
Defined in:
lib/zencoder-cli/extensions.rb

Instance Method Summary collapse

Instance Method Details

#constant?Boolean

Returns:

  • (Boolean)


3
4
5
6
7
8
9
10
11
12
# File 'lib/zencoder-cli/extensions.rb', line 3

def constant?
  names = self.split('::')
  names.shift if names.empty? || names.first.empty?
  constant = Object
  names.all? do |name|
    constant = constant.const_get(name)
  end
rescue NameError
  false
end