Method: Object.const_missing

Defined in:
lib/extensions/object_extensions.rb

.const_missing(value) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/extensions/object_extensions.rb', line 15

def const_missing(value)
  method_name = "#{value}".split("::")[-1] rescue ""
  if (("A".."Z").include?(method_name[0]))
    if(method_name.end_with?("b"))
      return BV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)])
    elsif(method_name.end_with?("i"))
      return IV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)])
    elsif(method_name.end_with?("f"))
      return LV.send(method_name[0..(method_name[-2] == "_" ? -3 : -2)])
    end
  end
  old_const_missing(value)
end