class Prism::Relocation::Entry

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

Public Class Methods

new(repository) click to toggle source

Initialize a new entry with the given repository.

# File prism/relocation.rb, line 24
def initialize(repository)
  @repository = repository
  @values = nil
end

Public Instance Methods

comments() click to toggle source

Fetch the leading and trailing comments of the value.

# File prism/relocation.rb, line 119
def comments
  leading_comments.concat(trailing_comments)
end
end_character_column() click to toggle source

Fetch the end character column of the value.

# File prism/relocation.rb, line 92
def end_character_column
  fetch_value(:end_character_column)
end
end_character_offset() click to toggle source

Fetch the end character offset of the value.

# File prism/relocation.rb, line 60
def end_character_offset
  fetch_value(:end_character_offset)
end
end_code_units_column() click to toggle source

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

# File prism/relocation.rb, line 104
def end_code_units_column
  fetch_value(:end_code_units_column)
end
end_code_units_offset() click to toggle source

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

# File prism/relocation.rb, line 72
def end_code_units_offset
  fetch_value(:end_code_units_offset)
end
end_column() click to toggle source

Fetch the end byte column of the value.

# File prism/relocation.rb, line 82
def end_column
  fetch_value(:end_column)
end
end_line() click to toggle source

Fetch the end line of the value.

# File prism/relocation.rb, line 40
def end_line
  fetch_value(:end_line)
end
end_offset() click to toggle source

Fetch the end byte offset of the value.

# File prism/relocation.rb, line 50
def end_offset
  fetch_value(:end_offset)
end
filepath() click to toggle source

Fetch the filepath of the value.

# File prism/relocation.rb, line 30
def filepath
  fetch_value(:filepath)
end
leading_comments() click to toggle source

Fetch the leading comments of the value.

# File prism/relocation.rb, line 109
def leading_comments
  fetch_value(:leading_comments)
end
start_character_column() click to toggle source

Fetch the start character column of the value.

# File prism/relocation.rb, line 87
def start_character_column
  fetch_value(:start_character_column)
end
start_character_offset() click to toggle source

Fetch the start character offset of the value.

# File prism/relocation.rb, line 55
def start_character_offset
  fetch_value(:start_character_offset)
end
start_code_units_column() click to toggle source

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

# File prism/relocation.rb, line 98
def start_code_units_column
  fetch_value(:start_code_units_column)
end
start_code_units_offset() click to toggle source

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

# File prism/relocation.rb, line 66
def start_code_units_offset
  fetch_value(:start_code_units_offset)
end
start_column() click to toggle source

Fetch the start byte column of the value.

# File prism/relocation.rb, line 77
def start_column
  fetch_value(:start_column)
end
start_line() click to toggle source

Fetch the start line of the value.

# File prism/relocation.rb, line 35
def start_line
  fetch_value(:start_line)
end
start_offset() click to toggle source

Fetch the start byte offset of the value.

# File prism/relocation.rb, line 45
def start_offset
  fetch_value(:start_offset)
end
trailing_comments() click to toggle source

Fetch the trailing comments of the value.

# File prism/relocation.rb, line 114
def trailing_comments
  fetch_value(:trailing_comments)
end

Private Instance Methods

fetch_value(name) click to toggle source

Fetch a value from the entry, raising an error if it is missing.

# File prism/relocation.rb, line 134
def fetch_value(name)
  values.fetch(name) do
    raise MissingValueError, "No value for #{name}, make sure the " \
      "repository has been properly configured"
  end
end
values() click to toggle source

Return the values from the repository, reifying them if necessary.

# File prism/relocation.rb, line 142
def values
  @values || (@repository.reify!; @values)
end