Class: LicenseScout::Reporter::Result
- Inherits:
-
Object
- Object
- LicenseScout::Reporter::Result
- Defined in:
- lib/license_scout/reporter.rb
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
Returns the value of attribute dependency.
-
#reason ⇒ Object
readonly
Returns the value of attribute reason.
Class Method Summary collapse
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #dependency_string ⇒ Object
-
#initialize(dependency, reason, did_succeed) ⇒ Result
constructor
A new instance of Result.
- #license_string ⇒ Object
- #reason_string ⇒ Object
- #succeeded? ⇒ Boolean
Constructor Details
#initialize(dependency, reason, did_succeed) ⇒ Result
Returns a new instance of Result.
40 41 42 43 44 |
# File 'lib/license_scout/reporter.rb', line 40 def initialize(dependency, reason, did_succeed) @dependency = dependency @reason = reason @did_succeed = did_succeed end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
Returns the value of attribute dependency.
37 38 39 |
# File 'lib/license_scout/reporter.rb', line 37 def dependency @dependency end |
#reason ⇒ Object (readonly)
Returns the value of attribute reason.
38 39 40 |
# File 'lib/license_scout/reporter.rb', line 38 def reason @reason end |
Class Method Details
.failure(dependency, reason) ⇒ Object
32 33 34 |
# File 'lib/license_scout/reporter.rb', line 32 def failure(dependency, reason) new(dependency, reason, false) end |
.success(dependency) ⇒ Object
28 29 30 |
# File 'lib/license_scout/reporter.rb', line 28 def success(dependency) new(dependency, nil, true) end |
Instance Method Details
#<=>(other) ⇒ Object
46 47 48 |
# File 'lib/license_scout/reporter.rb', line 46 def <=>(other) dependency.path <=> other.dependency.path end |
#dependency_string ⇒ Object
54 55 56 |
# File 'lib/license_scout/reporter.rb', line 54 def dependency_string dependency.uid end |
#license_string ⇒ Object
58 59 60 |
# File 'lib/license_scout/reporter.rb', line 58 def license_string dependency.license.records.map(&:id).compact.uniq.join(", ") end |
#reason_string ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/license_scout/reporter.rb', line 62 def reason_string case reason when :not_allowed "Not Allowed" when :flagged "Flagged" when :undetermined "Undetermined" when :missing "Missing" else "OK" end end |
#succeeded? ⇒ Boolean
50 51 52 |
# File 'lib/license_scout/reporter.rb', line 50 def succeeded? @did_succeed end |