Class: Prism::Relocation::Entry

Inherits:
Object
  • Object
show all
Defined in:
lib/prism/relocation.rb

Overview

An entry in a repository that will lazily reify its values when they are first accessed.

Defined Under Namespace

Classes: MissingValueError

Instance Method Summary collapse

Constructor Details

#initialize(repository) ⇒ Entry

Initialize a new entry with the given repository.



24
25
26
27
# File 'lib/prism/relocation.rb', line 24

def initialize(repository)
  @repository = repository
  @values = nil
end

Instance Method Details

#commentsObject

Fetch the leading and trailing comments of the value.



119
120
121
# File 'lib/prism/relocation.rb', line 119

def comments
  leading_comments.concat(trailing_comments)
end

#end_character_columnObject

Fetch the end character column of the value.



92
93
94
# File 'lib/prism/relocation.rb', line 92

def end_character_column
  fetch_value(:end_character_column)
end

#end_character_offsetObject

Fetch the end character offset of the value.



60
61
62
# File 'lib/prism/relocation.rb', line 60

def end_character_offset
  fetch_value(:end_character_offset)
end

#end_code_units_columnObject

Fetch the end code units column of the value, for the encoding that was configured on the repository.



104
105
106
# File 'lib/prism/relocation.rb', line 104

def end_code_units_column
  fetch_value(:end_code_units_column)
end

#end_code_units_offsetObject

Fetch the end code units offset of the value, for the encoding that was configured on the repository.



72
73
74
# File 'lib/prism/relocation.rb', line 72

def end_code_units_offset
  fetch_value(:end_code_units_offset)
end

#end_columnObject

Fetch the end byte column of the value.



82
83
84
# File 'lib/prism/relocation.rb', line 82

def end_column
  fetch_value(:end_column)
end

#end_lineObject

Fetch the end line of the value.



40
41
42
# File 'lib/prism/relocation.rb', line 40

def end_line
  fetch_value(:end_line)
end

#end_offsetObject

Fetch the end byte offset of the value.



50
51
52
# File 'lib/prism/relocation.rb', line 50

def end_offset
  fetch_value(:end_offset)
end

#filepathObject

Fetch the filepath of the value.



30
31
32
# File 'lib/prism/relocation.rb', line 30

def filepath
  fetch_value(:filepath)
end

#leading_commentsObject

Fetch the leading comments of the value.



109
110
111
# File 'lib/prism/relocation.rb', line 109

def leading_comments
  fetch_value(:leading_comments)
end

#reify!(values) ⇒ Object

Reify the values on this entry with the given values. This is an internal-only API that is called from the repository when it is time to reify the values.



126
127
128
129
# File 'lib/prism/relocation.rb', line 126

def reify!(values) # :nodoc:
  @repository = nil
  @values = values
end

#start_character_columnObject

Fetch the start character column of the value.



87
88
89
# File 'lib/prism/relocation.rb', line 87

def start_character_column
  fetch_value(:start_character_column)
end

#start_character_offsetObject

Fetch the start character offset of the value.



55
56
57
# File 'lib/prism/relocation.rb', line 55

def start_character_offset
  fetch_value(:start_character_offset)
end

#start_code_units_columnObject

Fetch the start code units column of the value, for the encoding that was configured on the repository.



98
99
100
# File 'lib/prism/relocation.rb', line 98

def start_code_units_column
  fetch_value(:start_code_units_column)
end

#start_code_units_offsetObject

Fetch the start code units offset of the value, for the encoding that was configured on the repository.



66
67
68
# File 'lib/prism/relocation.rb', line 66

def start_code_units_offset
  fetch_value(:start_code_units_offset)
end

#start_columnObject

Fetch the start byte column of the value.



77
78
79
# File 'lib/prism/relocation.rb', line 77

def start_column
  fetch_value(:start_column)
end

#start_lineObject

Fetch the start line of the value.



35
36
37
# File 'lib/prism/relocation.rb', line 35

def start_line
  fetch_value(:start_line)
end

#start_offsetObject

Fetch the start byte offset of the value.



45
46
47
# File 'lib/prism/relocation.rb', line 45

def start_offset
  fetch_value(:start_offset)
end

#trailing_commentsObject

Fetch the trailing comments of the value.



114
115
116
# File 'lib/prism/relocation.rb', line 114

def trailing_comments
  fetch_value(:trailing_comments)
end