Class: Lazylead::Task::Version
- Inherits:
-
Object
- Object
- Lazylead::Task::Version
- Defined in:
- lib/lazylead/task/fix_version.rb
Overview
Instance of “Fix Version” field for the particular task.
Instance Attribute Summary collapse
-
#issue ⇒ Object
readonly
Returns the value of attribute issue.
Instance Method Summary collapse
- #add_label ⇒ Object
-
#changed? ⇒ Boolean
Gives true when last change of “Fix Version” field was done by not authorized person.
-
#initialize(issue, allowed, silent) ⇒ Version
constructor
A new instance of Version.
-
#last ⇒ Object
Detect details about last change of “Fix Version” to non-null value.
- #to ⇒ Object
Constructor Details
#initialize(issue, allowed, silent) ⇒ Version
Returns a new instance of Version.
55 56 57 58 59 |
# File 'lib/lazylead/task/fix_version.rb', line 55 def initialize(issue, allowed, silent) @issue = issue @allowed = allowed @silent = silent end |
Instance Attribute Details
#issue ⇒ Object (readonly)
Returns the value of attribute issue.
53 54 55 |
# File 'lib/lazylead/task/fix_version.rb', line 53 def issue @issue end |
Instance Method Details
#add_label ⇒ Object
82 83 84 |
# File 'lib/lazylead/task/fix_version.rb', line 82 def add_label @issue.add_label("LL.IllegalChangeOfFixVersion") unless @silent end |
#changed? ⇒ Boolean
Gives true when last change of “Fix Version” field was done
by not authorized person.
63 64 65 66 67 68 |
# File 'lib/lazylead/task/fix_version.rb', line 63 def changed? @allowed.none? do |a| return false if last.nil? a == last["author"]["name"] end end |
#last ⇒ Object
Detect details about last change of “Fix Version” to non-null value
71 72 73 74 75 76 77 78 79 80 |
# File 'lib/lazylead/task/fix_version.rb', line 71 def last return @last if defined? @last @last = issue.history .reverse .find do |h| h["items"].any? do |i| i["field"] == "Fix Version" end end end |
#to ⇒ Object
86 87 88 89 90 |
# File 'lib/lazylead/task/fix_version.rb', line 86 def to versions = @issue.fields["fixVersions"] return "" if versions.nil? || versions.empty? versions.map { |x| x["name"] }.join(",") end |