Class: Dragnet::Exporters::Serializers::RepoSerializer
- Inherits:
-
Object
- Object
- Dragnet::Exporters::Serializers::RepoSerializer
- Defined in:
- lib/dragnet/exporters/serializers/repo_serializer.rb
Overview
Serializes a Repo
object into a Hash
Instance Attribute Summary collapse
-
#repo ⇒ Object
readonly
Returns the value of attribute repo.
Instance Method Summary collapse
-
#initialize(repo) ⇒ RepoSerializer
constructor
A new instance of RepoSerializer.
-
#serialize ⇒ Hash
Serializes the given
Repo
object.
Constructor Details
#initialize(repo) ⇒ RepoSerializer
Returns a new instance of RepoSerializer.
14 15 16 |
# File 'lib/dragnet/exporters/serializers/repo_serializer.rb', line 14 def initialize(repo) @repo = repo end |
Instance Attribute Details
#repo ⇒ Object (readonly)
Returns the value of attribute repo.
11 12 13 |
# File 'lib/dragnet/exporters/serializers/repo_serializer.rb', line 11 def repo @repo end |
Instance Method Details
#serialize ⇒ Hash
Serializes the given Repo
object.
20 21 22 23 24 25 26 27 |
# File 'lib/dragnet/exporters/serializers/repo_serializer.rb', line 20 def serialize { path: repo.path, sha1: repo.sha1 }.tap do |hash| hash[:files] = serialize_files if repo.files.present? end end |