Class: ActiveSupport::Dependencies::Reference

Inherits:
Object
  • Object
show all
Defined in:
activesupport/lib/active_support/dependencies.rb

Constant Summary

@@constants =
Hash.new { |h, k| h[k] = Inflector.constantize(k) }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name) ⇒ Reference

Returns a new instance of Reference



527
528
529
530
# File 'activesupport/lib/active_support/dependencies.rb', line 527

def initialize(name)
  @name = name.to_s
  @@constants[@name] = name if name.respond_to?(:name)
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name



525
526
527
# File 'activesupport/lib/active_support/dependencies.rb', line 525

def name
  @name
end

Class Method Details

.clear!Object



536
537
538
# File 'activesupport/lib/active_support/dependencies.rb', line 536

def self.clear!
  @@constants.clear
end

Instance Method Details

#getObject



532
533
534
# File 'activesupport/lib/active_support/dependencies.rb', line 532

def get
  @@constants[@name]
end