Class: RuboCop::CachedData Private
- Inherits:
-
Object
- Object
- RuboCop::CachedData
- Defined in:
- lib/rubocop/cached_data.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Converts RuboCop objects to and from the serialization format JSON.
Instance Method Summary collapse
- #from_json(text) ⇒ Object private
-
#initialize(filename) ⇒ CachedData
constructor
private
A new instance of CachedData.
- #to_json(offenses) ⇒ Object private
Constructor Details
#initialize(filename) ⇒ CachedData
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of CachedData.
9 10 11 |
# File 'lib/rubocop/cached_data.rb', line 9 def initialize(filename) @filename = filename end |
Instance Method Details
#from_json(text) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
13 14 15 |
# File 'lib/rubocop/cached_data.rb', line 13 def from_json(text) deserialize_offenses(JSON.parse(text)) end |
#to_json(offenses) ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
17 18 19 |
# File 'lib/rubocop/cached_data.rb', line 17 def to_json(offenses) JSON.dump(offenses.map { |o| serialize_offense(o) }) end |