Module: MetaProgramming::Object::ClassMethods::Helpers

Defined in:
lib/meta_programming/object.rb

Class Method Summary collapse

Class Method Details

.compose_chaining_symbols(method_name, ext) ⇒ Object



18
19
20
21
22
# File 'lib/meta_programming/object.rb', line 18

def self.compose_chaining_symbols(method_name, ext)
  stripped_method_name, punctuation = method_name.to_s.sub(/([?!=])$/, ''), $1
  ["#{stripped_method_name}_with_#{ext}#{punctuation}".to_sym,
    "#{stripped_method_name}_without_#{ext}#{punctuation}".to_sym]
end

.escape_method_name(method_name) ⇒ Object



24
25
26
# File 'lib/meta_programming/object.rb', line 24

def self.escape_method_name(method_name)
  method_name.to_s.gsub(/\?/, 'qmark').gsub(/\!/, 'bang').gsub(/\=/, 'equal')
end