Class: Controlrepo::Class
- Inherits:
-
Object
- Object
- Controlrepo::Class
- Defined in:
- lib/controlrepo/class.rb
Constant Summary collapse
- @@all =
[]
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name) ⇒ Class
constructor
A new instance of Class.
Constructor Details
#initialize(name) ⇒ Class
Returns a new instance of Class.
6 7 8 9 |
# File 'lib/controlrepo/class.rb', line 6 def initialize(name) @name = name @@all << self end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/controlrepo/class.rb', line 5 def name @name end |
Class Method Details
.all ⇒ Object
24 25 26 |
# File 'lib/controlrepo/class.rb', line 24 def self.all @@all end |
.find(class_name) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/controlrepo/class.rb', line 11 def self.find(class_name) @@all.each do |cls| if class_name.is_a?(Controlrepo::Class) if cls = class_name return cls end elsif cls.name == class_name return cls end end nil end |