Sha256: cf3fa52da490389858743eea3e37f49011a065108775bb308ad996a97cb7bf4f

Contents?: true

Size: 791 Bytes

Versions: 13

Compression:

Stored size: 791 Bytes

Contents

require 'facets/core/kernel/op_esc'

module Kernel

  private

  # Require a file with puncuation marks escaped using NANOESC table.
  #
  #   require_esc '[].rb'
  #
  # in actuality requires the file 'op_fetch.rb'.

  def require_esc( fpath )
    fdir, fname = File.split(fpath)
    ename = op_esc( fname )
    case ename[-1,1] ; when '!','=','?' then ename = ename[0...-1] ; end
    epath = File.join( fdir, ename )
    require( epath )
  end

end



#  _____         _
# |_   _|__  ___| |_
#   | |/ _ \/ __| __|
#   | |  __/\__ \ |_
#   |_|\___||___/\__|
#
=begin test

  require 'test/unit'

  class TCKernel < Test::Unit::TestCase

    def test_require_esc
      assert_nothing_raised { require_esc 'facet/string/blank' }
      assert( "".respond_to?( :blank? ) )
    end

  end

=end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
facets-1.4.0 lib/facets/core/kernel/require_esc.rb
facets-1.4.1 lib/facets/core/kernel/require_esc.rb
facets-1.4.2 lib/facets/core/kernel/require_esc.rb
facets-1.4.3 lib/facets/core/kernel/require_esc.rb
facets-1.4.4 lib/facets/core/kernel/require_esc.rb
facets-1.4.5 lib/facets/core/kernel/require_esc.rb
facets-1.7.0 lib/facets/core/kernel/require_esc.rb
facets-1.7.30 lib/facets/core/kernel/require_esc.rb
facets-1.7.38 lib/facets/core/kernel/require_esc.rb
facets-1.7.46 lib/facets/core/kernel/require_esc.rb
facets-1.8.0 lib/facets/core/kernel/require_esc.rb
facets-1.8.20 lib/facets/core/kernel/require_esc.rb
facets-1.8.8 lib/facets/core/kernel/require_esc.rb