Class: Mudguard::Domain::Source
- Inherits:
-
Object
- Object
- Mudguard::Domain::Source
- Defined in:
- lib/mudguard/domain/source.rb
Overview
Represents a Ruby source file
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
- #find_consts ⇒ Object
- #find_mod_dependencies(consts) ⇒ Object
- #hash ⇒ Object
-
#initialize(location:, code_loader: -> { "" }) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
- #location?(glob) ⇒ Boolean
Constructor Details
#initialize(location:, code_loader: -> { "" }) ⇒ Source
Returns a new instance of Source.
21 22 23 24 |
# File 'lib/mudguard/domain/source.rb', line 21 def initialize(location:, code_loader: -> { "" }) @code_loader = code_loader @location = location end |
Instance Method Details
#==(other) ⇒ Object
26 27 28 |
# File 'lib/mudguard/domain/source.rb', line 26 def ==(other) @location == other.instance_eval { @location } end |
#eql?(other) ⇒ Boolean
34 35 36 |
# File 'lib/mudguard/domain/source.rb', line 34 def eql?(other) @location.eql?(other.instance_eval { @location }) end |
#find_consts ⇒ Object
48 49 50 51 52 |
# File 'lib/mudguard/domain/source.rb', line 48 def find_consts visitor = ConstVisitor.new visit_ast(visitor) visitor.consts end |
#find_mod_dependencies(consts) ⇒ Object
42 43 44 45 46 |
# File 'lib/mudguard/domain/source.rb', line 42 def find_mod_dependencies(consts) visitor = DependencyVisitor.new(consts: consts) visit_ast(visitor) visitor.dependencies end |
#hash ⇒ Object
30 31 32 |
# File 'lib/mudguard/domain/source.rb', line 30 def hash @location.hash end |
#inspect ⇒ Object
38 39 40 |
# File 'lib/mudguard/domain/source.rb', line 38 def inspect @location end |
#location?(glob) ⇒ Boolean
54 55 56 |
# File 'lib/mudguard/domain/source.rb', line 54 def location?(glob) @location == glob end |