Module: Rdbc::Translator

Defined in:
lib/rdbc/translator.rb

Overview

TODO rename to Rdbc::Translating

Constant Summary collapse

OPERATOR =
{
  :[]  => :op_element_read,
  :[]= => :op_element_write,
  :**  => :op_power,
  :~   => :op_not,
  :+@  => :op_unary_plus,
  :-@  => :op_unary_minus,
  :*   => :op_product,
  :/   => :op_quotient,
  :%   => :op_modulo,
  :+   => :op_plus,
  :-   => :op_minus,
  :>>  => :op_right_shift,
  :<<  => :op_left_shift,
  :&   => :op_and,
  :^   => :op_xor,
  :|   => :op_or,
  :<=  => :op_less_or_equal,
  :<   => :op_less,
  :>   => :op_greater,
  :>=  => :op_greater_or_equal,
  :<=> => :op_comparison,
  :==  => :op_eql,
  :=== => :op_case_comparison,
  :=~  => :op_match
}

Class Method Summary collapse

Class Method Details

.method_post(method) ⇒ Object



9
10
11
# File 'lib/rdbc/translator.rb', line 9

def self.method_post(method)
  method_with_prefix(method, :post)
end

.method_pre(method) ⇒ Object



5
6
7
# File 'lib/rdbc/translator.rb', line 5

def self.method_pre(method)
   method_with_prefix(method, :pre)
end

.method_with_prefix(method, type) ⇒ Object



13
14
15
# File 'lib/rdbc/translator.rb', line 13

def self.method_with_prefix(method, type)
  :"#{type}_#{OPERATOR[method] || method}"
end