Class: Codebeacon::Tracer::NodeSource
- Inherits:
-
Object
- Object
- Codebeacon::Tracer::NodeSource
- Defined in:
- lib/codebeacon/tracer/src/models/node_source.rb
Class Attribute Summary collapse
-
.instances ⇒ Object
Returns the value of attribute instances.
Instance Attribute Summary collapse
-
#id ⇒ Object
Returns the value of attribute id.
-
#name ⇒ Object
Returns the value of attribute name.
-
#root_path ⇒ Object
Returns the value of attribute root_path.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, root_path) ⇒ NodeSource
constructor
A new instance of NodeSource.
Constructor Details
#initialize(name, root_path) ⇒ NodeSource
Returns a new instance of NodeSource.
13 14 15 16 17 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 13 def initialize(name, root_path) @name = name @root_path = root_path self.class.instances << self end |
Class Attribute Details
.instances ⇒ Object
Returns the value of attribute instances.
10 11 12 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 10 def instances @instances end |
Instance Attribute Details
#id ⇒ Object
Returns the value of attribute id.
6 7 8 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 6 def id @id end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 6 def name @name end |
#root_path ⇒ Object
Returns the value of attribute root_path.
6 7 8 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 6 def root_path @root_path end |
Class Method Details
.clear ⇒ Object
27 28 29 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 27 def self.clear self.instances = [] end |
.find(path) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/codebeacon/tracer/src/models/node_source.rb', line 19 def self.find(path) return nil if path.nil? Pathname.new(path).ascend do |dir| source = self.instances.find { |ns| dir.to_s == ns.root_path } return source if source end end |