Class: StaticSourceLoc::Source
- Inherits:
-
Object
- Object
- StaticSourceLoc::Source
- Extended by:
- Forwardable
- Defined in:
- lib/static_source_loc.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#parent ⇒ Object
readonly
Returns the value of attribute parent.
-
#source_locs ⇒ Object
readonly
Returns the value of attribute source_locs.
Instance Method Summary collapse
-
#initialize(name, parent) ⇒ Source
constructor
A new instance of Source.
- #inspect ⇒ Object
- #new_loc(file, line) ⇒ Object
- #source_loc ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(name, parent) ⇒ Source
Returns a new instance of Source.
15 16 17 18 |
# File 'lib/static_source_loc.rb', line 15 def initialize(name, parent) @name, @parent = name, parent @source_locs = [] end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
13 14 15 |
# File 'lib/static_source_loc.rb', line 13 def name @name end |
#parent ⇒ Object (readonly)
Returns the value of attribute parent.
13 14 15 |
# File 'lib/static_source_loc.rb', line 13 def parent @parent end |
#source_locs ⇒ Object (readonly)
Returns the value of attribute source_locs.
13 14 15 |
# File 'lib/static_source_loc.rb', line 13 def source_locs @source_locs end |
Instance Method Details
#inspect ⇒ Object
35 36 37 |
# File 'lib/static_source_loc.rb', line 35 def inspect "#<#{self.class.class_name}: #{qualname}>" end |
#new_loc(file, line) ⇒ Object
20 21 22 23 |
# File 'lib/static_source_loc.rb', line 20 def new_loc(file, line) source_locs << SourceLoc[file, line] self end |
#source_loc ⇒ Object
25 26 27 |
# File 'lib/static_source_loc.rb', line 25 def source_loc source_locs.first end |
#to_s ⇒ Object
31 32 33 |
# File 'lib/static_source_loc.rb', line 31 def to_s qualname end |