Methods
Constants
OPERATORS = %w{ +@ -@ + - ** * / % ~ <=> << >> < > === == =~ <= >= | & ^ []= [] }
OPERATORS_REGEXP = Regexp.new( '(' << OPERATORS.collect{ |k| Regexp.escape(k) }.join('|') << ')' )
OPERATORS_ESC_TABLE = { "+@" => "op_plus_self", "-@" => "op_minus_self", "+" => "op_plus", "-" => "op_minus", "**" => "op_pow", "*" => "op_mul", "/" => "op_div", "%" => "op_mod", "~" => "op_tilde", "<=>" => "op_cmp", "<<" => "op_lshift", ">>" => "op_rshift", "<" => "op_lt", ">" => "op_gt", "===" => "op_case_eq", "==" => "op_equal", "=~" => "op_apply", "<=" => "op_lt_eq", ">=" => "op_gt_eq", "|" => "op_or", "&" => "op_and", "^" => "op_xor", "[]=" => "op_store", "[]" => "op_fetch"
Public Class methods
escape(str)

Applies operator escape‘s according to OPERATORS_ESCAPE_TABLE.

  op_esc('-') #=> "op_minus"

  CREDIT: Trans
# File lib/more/facets/opesc.rb, line 40
  def self.escape(str)
    str.gsub(OPERATORS_REGEXP){ OPERATORS_ESC_TABLE[$1] }
  end