Class: File

Inherits:
Object show all
Defined in:
lib/rucola/rucola_support/core_ext/ruby/file.rb

Class Method Summary collapse

Class Method Details

.to_const(file) ⇒ Object

Returns the constant version of the file that is referred to.

File.to_const("/some/path/foo_bar_controller.rb") # => FooBarController


6
7
8
9
# File 'lib/rucola/rucola_support/core_ext/ruby/file.rb', line 6

def to_const(file)
  file.match /(\w+)\.\w*$/
  $1.to_const
end