Class: Bibliothecary::ParserResult
- Inherits:
-
Object
- Object
- Bibliothecary::ParserResult
- Defined in:
- lib/bibliothecary/parser_result.rb
Overview
ParserResult bundles together a list of dependencies and the project name.
Constant Summary collapse
- FIELDS =
i[ dependencies project_name ].freeze
Instance Attribute Summary collapse
-
#dependencies ⇒ Array<Dependency>
readonly
The list of Dependency objects.
-
#project_name ⇒ String?
readonly
The name of the project.
Instance Method Summary collapse
- #eql?(other) ⇒ Boolean (also: #==)
- #hash ⇒ Object
-
#initialize(dependencies:, project_name: nil) ⇒ ParserResult
constructor
A new instance of ParserResult.
- #to_h ⇒ Object
Constructor Details
#initialize(dependencies:, project_name: nil) ⇒ ParserResult
16 17 18 19 20 21 22 |
# File 'lib/bibliothecary/parser_result.rb', line 16 def initialize( dependencies:, project_name: nil ) @dependencies = dependencies @project_name = project_name end |
Instance Attribute Details
#dependencies ⇒ Array<Dependency> (readonly)
The list of Dependency objects
8 9 10 |
# File 'lib/bibliothecary/parser_result.rb', line 8 def dependencies @dependencies end |
#project_name ⇒ String? (readonly)
The name of the project
8 9 10 |
# File 'lib/bibliothecary/parser_result.rb', line 8 def project_name @project_name end |
Instance Method Details
#eql?(other) ⇒ Boolean Also known as: ==
24 25 26 |
# File 'lib/bibliothecary/parser_result.rb', line 24 def eql?(other) FIELDS.all? { |f| public_send(f) == other.public_send(f) } end |
#hash ⇒ Object
33 34 35 |
# File 'lib/bibliothecary/parser_result.rb', line 33 def hash FIELDS.map { |f| public_send(f) }.hash end |
#to_h ⇒ Object
29 30 31 |
# File 'lib/bibliothecary/parser_result.rb', line 29 def to_h FIELDS.to_h { |f| [f, public_send(f)] } end |