Module: General
- Defined in:
- lib/robust_excel_ole/general.rb
Defined Under Namespace
Classes: VBAMethodMissingError
Class Method Summary collapse
-
.absolute_path(file) ⇒ Object
:nodoc: #.
-
.canonize(filename) ⇒ Object
:nodoc: #.
-
.normalize(path) ⇒ Object
:nodoc: #.
Class Method Details
.absolute_path(file) ⇒ Object
:nodoc: #
5 6 7 8 9 |
# File 'lib/robust_excel_ole/general.rb', line 5 def absolute_path(file) # :nodoc: # file = File.(file) file = RobustExcelOle::Cygwin.cygpath('-w', file) if RUBY_PLATFORM =~ /cygwin/ WIN32OLE.new('Scripting.FileSystemObject').GetAbsolutePathName(file) end |
.canonize(filename) ⇒ Object
:nodoc: #
11 12 13 14 |
# File 'lib/robust_excel_ole/general.rb', line 11 def canonize(filename) # :nodoc: # raise TypeREOError, "No string given to canonize, but #{filename.inspect}" unless filename.is_a?(String) normalize(filename).downcase end |
.normalize(path) ⇒ Object
:nodoc: #
16 17 18 19 20 21 22 |
# File 'lib/robust_excel_ole/general.rb', line 16 def normalize(path) # :nodoc: # path = path.gsub('/./', '/') + '/' path = path.gsub(/[\/\\]+/, "/") nil while path.gsub!(/(\/|^)(?!\.\.?)([^\/]+)\/\.\.\//, '\1') path = path.chomp("/") path end |