Class: Safer::IVarFactory::Prefix::Full

Inherits:
Safer::IVarFactory::Prefix show all
Defined in:
lib/safer/ivarfactory/prefix.rb

Class Method Summary collapse

Methods inherited from Safer::IVarFactory::Prefix

is_anon

Class Method Details

.class_symbol_prefix(klass) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/safer/ivarfactory/prefix.rb', line 7

def self.class_symbol_prefix(klass)
  klass.to_s.split('::').inject(nil) do |memo, el|
    # reset the symbol name when an anonymous class is encountered.
    if self.is_anon(el)
      nil
    elsif memo
      memo + '_' + el.downcase
    else
      el.downcase
    end
  end
end