Class: InspectedBy::Inspection
- Inherits:
-
Object
- Object
- InspectedBy::Inspection
- Defined in:
- lib/inspected_by/core.rb
Instance Attribute Summary collapse
-
#comment ⇒ Object
readonly
Returns the value of attribute comment.
-
#guid ⇒ Object
readonly
Returns the value of attribute guid.
-
#inspected_at ⇒ Object
readonly
Returns the value of attribute inspected_at.
-
#inspector_email ⇒ Object
readonly
Returns the value of attribute inspector_email.
-
#inspector_name ⇒ Object
readonly
Returns the value of attribute inspector_name.
-
#sha ⇒ Object
readonly
Returns the value of attribute sha.
Class Method Summary collapse
Instance Method Summary collapse
- #append ⇒ Object
-
#initialize(repo, params) ⇒ Inspection
constructor
A new instance of Inspection.
Constructor Details
#initialize(repo, params) ⇒ Inspection
Returns a new instance of Inspection.
64 65 66 67 68 69 70 71 72 |
# File 'lib/inspected_by/core.rb', line 64 def initialize(repo, params) @repo = repo @comment = params['comment'] @inspected_at = params['inspected_at'] @inspector_email = params['inspector_email'] @inspector_name = params['inspector_name'] @guid = params['guid'] @sha = params['sha'] end |
Instance Attribute Details
#comment ⇒ Object (readonly)
Returns the value of attribute comment.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def comment @comment end |
#guid ⇒ Object (readonly)
Returns the value of attribute guid.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def guid @guid end |
#inspected_at ⇒ Object (readonly)
Returns the value of attribute inspected_at.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def inspected_at @inspected_at end |
#inspector_email ⇒ Object (readonly)
Returns the value of attribute inspector_email.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def inspector_email @inspector_email end |
#inspector_name ⇒ Object (readonly)
Returns the value of attribute inspector_name.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def inspector_name @inspector_name end |
#sha ⇒ Object (readonly)
Returns the value of attribute sha.
62 63 64 |
# File 'lib/inspected_by/core.rb', line 62 def sha @sha end |
Class Method Details
.find_all(repo, sha) ⇒ Object
74 75 76 77 78 79 80 81 82 83 84 |
# File 'lib/inspected_by/core.rb', line 74 def self.find_all(repo, sha) repo.git.notes({raise: true, ref: 'inspected-by'}, ['show', sha]). split("\n"). map {|note| Inspection.new(repo, JSON.parse(note)) } rescue Grit::Git::CommandFailed => e if /No note found for object/ === e. [] else raise e end end |
Instance Method Details
#append ⇒ Object
86 87 88 89 |
# File 'lib/inspected_by/core.rb', line 86 def append @repo.git.notes({raise: true, ref: 'inspected-by'}, ['append', "--message=#{}", @sha]) end |