Sha256: 9047e7dd94d5b601bbadd3da2a1efc980c0bf79f8e63362dfe0ca1c96bccdc72

Contents?: true

Size: 507 Bytes

Versions: 3

Compression:

Stored size: 507 Bytes

Contents

# Provides long name aliases for Detest's default abbreviated vocabulary.

require 'detest'

module Detest
  short_to_long = {
    'T' => 'True',
    'F' => 'False',
    'N' => 'Nil',
    'E' => 'Error',
    'C' => 'Catch',
    'I' => 'Inform',
    'S' => 'Share',
    'D' => 'Describe',
  }

  short_to_long.each do |src, dst|
    instance_methods(false).grep(/^#{src}\b/).each do |short|
      long = short.to_s.sub(src, dst)
      alias_method long, short
    end
  end

  # for hooks
  Describe = D
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
detest-3.1.3 lib/detest/long.rb
detest-3.1.2 lib/detest/long.rb
detest-3.1.1 lib/detest/long.rb