Method: Persian::Text.method_missing

Defined in:
lib/persian/dynamic.rb

.method_missing(method, *arg, &block) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/persian/dynamic.rb', line 7

def self.method_missing(method, *arg, &block)
  # remove methods
  if method.to_s =~ /^remove_\w*/
    # get method characters without remove_
    char = method.to_s.gsub(/^remove_(\w*)/, '\1').upcase

    # execute remove_character if char is a valid constant
    if constant? char
      text = Persian.rm_char(arg[0], get_constant(char))
      text
    else
      super
    end
  else
    # Run default no method error
    super
  end
end