Class: DepsGrapher::Event
- Inherits:
-
Object
- Object
- DepsGrapher::Event
- Defined in:
- lib/deps_grapher/event.rb
Instance Attribute Summary collapse
-
#const_name ⇒ Object
Returns the value of attribute const_name.
-
#location ⇒ Object
Returns the value of attribute location.
-
#method ⇒ Object
Returns the value of attribute method.
-
#name ⇒ Object
Returns the value of attribute name.
Class Method Summary collapse
- .add(name:, const_name:, location:, method: nil) ⇒ Object
- .generate_key(name, const_name, method) ⇒ Object
Instance Method Summary collapse
-
#initialize(name:, const_name:, location:, method:) ⇒ Event
constructor
A new instance of Event.
- #key ⇒ Object
- #processing! ⇒ Object
- #processing? ⇒ Boolean
- #skip_processing! ⇒ Object
Constructor Details
#initialize(name:, const_name:, location:, method:) ⇒ Event
Returns a new instance of Event.
39 40 41 42 43 44 45 |
# File 'lib/deps_grapher/event.rb', line 39 def initialize(name:, const_name:, location:, method:) @name = name @const_name = const_name @location = location @method = method @skip_processing = false end |
Instance Attribute Details
#const_name ⇒ Object
Returns the value of attribute const_name.
37 38 39 |
# File 'lib/deps_grapher/event.rb', line 37 def const_name @const_name end |
#location ⇒ Object
Returns the value of attribute location.
37 38 39 |
# File 'lib/deps_grapher/event.rb', line 37 def location @location end |
#method ⇒ Object
Returns the value of attribute method.
37 38 39 |
# File 'lib/deps_grapher/event.rb', line 37 def method @method end |
#name ⇒ Object
Returns the value of attribute name.
37 38 39 |
# File 'lib/deps_grapher/event.rb', line 37 def name @name end |
Class Method Details
.add(name:, const_name:, location:, method: nil) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/deps_grapher/event.rb', line 15 def add(name:, const_name:, location:, method: nil) key = generate_key name, const_name, method return nil if key.nil? registry[key] ||= new( name: name, const_name: const_name, location: location, method: method ) end |
.generate_key(name, const_name, method) ⇒ Object
6 7 8 9 10 11 12 13 |
# File 'lib/deps_grapher/event.rb', line 6 def generate_key(name, const_name, method) return nil if const_name.nil? && method.nil? key = name.to_s.dup key << ".#{const_name}" if const_name key << ".#{method}" if method key end |
Instance Method Details
#key ⇒ Object
47 48 49 |
# File 'lib/deps_grapher/event.rb', line 47 def key self.class.generate_key name, const_name, method end |
#processing! ⇒ Object
51 52 53 |
# File 'lib/deps_grapher/event.rb', line 51 def processing! @skip_processing = false end |
#processing? ⇒ Boolean
59 60 61 |
# File 'lib/deps_grapher/event.rb', line 59 def processing? !@skip_processing end |
#skip_processing! ⇒ Object
55 56 57 |
# File 'lib/deps_grapher/event.rb', line 55 def skip_processing! @skip_processing = true end |