1. Prism::
  2. Relocation::
  3. Repository

class Prism::Relocation::Repository

A repository is a configured collection of fields and a set of entries that knows how to reparse a source and reify the values.

Attributes

entries[R]

The entries that have been saved on this repository.

fields[R]

The fields that have been configured on this repository.

source[R]

The source associated with this repository. This will be either aSourceFilepath (the most common use case) or aSourceString.

Public Class Methods

Source
# File lib/prism/relocation.rb, line 370definitialize(source)@source =source@fields = {}@entries =Hash.new {|hash,node_id|hash[node_id] = {} }end

Initialize a new repository with the given source.

Public Instance Methods

Source
# File lib/prism/relocation.rb, line 416defcharacter_columnsfield(:character_columns,CharacterColumnsField.new)end

Configure the character columns field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 399defcharacter_offsetsfield(:character_offsets,CharacterOffsetsField.new)end

Configure the character offsets field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 422defcode_unit_columns(encoding)field(:code_unit_columns,CodeUnitColumnsField.new(self,encoding))end

Configure the code unit columns field for this repository for a specific encoding and return self.

Source
# File lib/prism/relocation.rb, line 405defcode_unit_offsets(encoding)field(:code_unit_offsets,CodeUnitOffsetsField.new(self,encoding))end

Configure the code unit offsets field for this repository for a specific encoding and return self.

Source
# File lib/prism/relocation.rb, line 377defcode_units_cache(encoding)source.code_units_cache(encoding)end

Create a code units cache for the given encoding from the source.

Source
# File lib/prism/relocation.rb, line 410defcolumnsfield(:columns,ColumnsField.new)end

Configure the columns field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 440defcommentsleading_comments.trailing_commentsend

Configure both the leading and trailing comment fields for this repository and return self.

Source
# File lib/prism/relocation.rb, line 382deffilepathraiseConfigurationError,"Can only specify filepath for a filepath source"unlesssource.is_a?(SourceFilepath)field(:filepath,FilepathField.new(source.value))end

Configure the filepath field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 428defleading_commentsfield(:leading_comments,LeadingCommentsField.new)end

Configure the leading comments field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 388deflinesfield(:lines,LinesField.new)end

Configure the lines field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 393defoffsetsfield(:offsets,OffsetsField.new)end

Configure the offsets field for this repository and return self.

Source
# File lib/prism/relocation.rb, line 434deftrailing_commentsfield(:trailing_comments,TrailingCommentsField.new)end

Configure the trailing comments field for this repository and return self.

Private Instance Methods

Source
# File lib/prism/relocation.rb, line 488deffield(name,value)raiseConfigurationError,"Cannot specify multiple #{name} fields"if@fields.key?(name)@fields[name] =valueselfend

Append the given field to the repository and return the repository so that these calls can be chained.