Module: Rdbc::Translating
Instance Method Summary collapse
- #method_post(method) ⇒ Object
- #method_pre(method) ⇒ Object
- #method_with_prefix(method, type) ⇒ Object
- #operator(method) ⇒ Object
Instance Method Details
#method_post(method) ⇒ Object
7 8 9 |
# File 'lib/rdbc/translating.rb', line 7 def method_post(method) method_with_prefix(method, :post) end |
#method_pre(method) ⇒ Object
3 4 5 |
# File 'lib/rdbc/translating.rb', line 3 def method_pre(method) method_with_prefix(method, :pre) end |
#method_with_prefix(method, type) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/rdbc/translating.rb', line 11 def method_with_prefix(method, type) operator = operator(method) ( type.to_s + '_' + if operator.nil? method.to_s else 'op_' + operator.to_s end ).to_sym end |
#operator(method) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/rdbc/translating.rb', line 22 def operator(method) { :[] => :element_read, :[]= => :element_write, :** => :power, :~ => :not, :+@ => :unary_plus, :-@ => :unary_minus, :* => :product, :/ => :quotient, :% => :modulo, :+ => :plus, :- => :minus, :>> => :right_shift, :<< => :left_shift, :& => :and, :^ => :xor, :| => :or, :<= => :less_or_equal, :< => :less, :> => :greater, :>= => :greater_or_equal, :<=> => :comparison, :== => :eql, :=== => :case_comparison, :=~ => :match }[method] end |