Class: ActiveSupport::Dependencies::Reference

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

Constant Summary collapse

@@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.



529
530
531
532
# File 'lib/active_support/dependencies.rb', line 529

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.



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

def name
  @name
end

Class Method Details

.clear!Object



538
539
540
# File 'lib/active_support/dependencies.rb', line 538

def self.clear!
  @@constants.clear
end

Instance Method Details

#getObject



534
535
536
# File 'lib/active_support/dependencies.rb', line 534

def get
  @@constants[@name]
end