Class: Lazylead::Comments

Inherits:
Object
  • Object
show all
Defined in:
lib/lazylead/system/jira.rb

Overview

The jira issue comments

Author

Yurii Dubinka ([email protected])

Copyright

Copyright © 2019-2020 Yurii Dubinka

License

MIT

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issue, sys) ⇒ Comments

Returns a new instance of Comments.



277
278
279
280
# File 'lib/lazylead/system/jira.rb', line 277

def initialize(issue, sys)
  @issue = issue
  @sys = sys
end

Instance Attribute Details

#issueObject (readonly)

Returns the value of attribute issue.



275
276
277
# File 'lib/lazylead/system/jira.rb', line 275

def issue
  @issue
end

Instance Method Details

#body?(text) ⇒ Boolean

Returns:

  • (Boolean)


282
283
284
# File 'lib/lazylead/system/jira.rb', line 282

def body?(text)
  comments.any? { |c| c.attrs["body"].include? text }
end

#commentsObject



286
287
288
289
290
291
# File 'lib/lazylead/system/jira.rb', line 286

def comments
  @comments ||= @sys.raw do |conn|
    conn.Issue.find(@issue.id, expand: "comments,changelog", fields: "")
        .comments
  end
end

#last(quantity) ⇒ Object



293
294
295
# File 'lib/lazylead/system/jira.rb', line 293

def last(quantity)
  comments.last(quantity).map { |c| c.attrs["body"] }
end