Class: BlockedStalledChange
- Defined in:
- lib/jirametrics/blocked_stalled_change.rb
Instance Attribute Summary collapse
-
#blocking_issue_keys ⇒ Object
readonly
Returns the value of attribute blocking_issue_keys.
-
#flag ⇒ Object
readonly
Returns the value of attribute flag.
-
#stalled_days ⇒ Object
readonly
Returns the value of attribute stalled_days.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_is_blocking ⇒ Object
readonly
Returns the value of attribute status_is_blocking.
-
#time ⇒ Object
readonly
Returns the value of attribute time.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #active? ⇒ Boolean
- #blocked? ⇒ Boolean
- #blocked_by_status? ⇒ Boolean
-
#initialize(time:, flagged: nil, status: nil, status_is_blocking: true, blocking_issue_keys: nil, stalled_days: nil) ⇒ BlockedStalledChange
constructor
A new instance of BlockedStalledChange.
- #reasons ⇒ Object
- #stalled? ⇒ Boolean
- #stalled_by_status? ⇒ Boolean
- #state ⇒ Object
Constructor Details
#initialize(time:, flagged: nil, status: nil, status_is_blocking: true, blocking_issue_keys: nil, stalled_days: nil) ⇒ BlockedStalledChange
Returns a new instance of BlockedStalledChange.
6 7 8 9 10 11 12 13 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 6 def initialize time:, flagged: nil, status: nil, status_is_blocking: true, blocking_issue_keys: nil, stalled_days: nil @flag = flagged @status = status @status_is_blocking = status_is_blocking @blocking_issue_keys = blocking_issue_keys @stalled_days = stalled_days @time = time end |
Instance Attribute Details
#blocking_issue_keys ⇒ Object (readonly)
Returns the value of attribute blocking_issue_keys.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def blocking_issue_keys @blocking_issue_keys end |
#flag ⇒ Object (readonly)
Returns the value of attribute flag.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def flag @flag end |
#stalled_days ⇒ Object (readonly)
Returns the value of attribute stalled_days.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def stalled_days @stalled_days end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def status @status end |
#status_is_blocking ⇒ Object (readonly)
Returns the value of attribute status_is_blocking.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def status_is_blocking @status_is_blocking end |
#time ⇒ Object (readonly)
Returns the value of attribute time.
4 5 6 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 4 def time @time end |
Instance Method Details
#==(other) ⇒ Object
22 23 24 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 22 def ==(other) (other.class == self.class) && (other.state == state) end |
#active? ⇒ Boolean
17 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 17 def active? = !blocked? && !stalled? |
#blocked? ⇒ Boolean
15 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 15 def blocked? = @flag || blocked_by_status? || @blocking_issue_keys |
#blocked_by_status? ⇒ Boolean
19 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 19 def blocked_by_status? = (@status && @status_is_blocking) |
#reasons ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 30 def reasons result = [] if blocked? result << 'Blocked by flag' if @flag result << "Blocked by status: #{@status}" if blocked_by_status? result << "Blocked by issues: #{@blocking_issue_keys.join(', ')}" if @blocking_issue_keys elsif stalled_by_status? result << "Stalled by status: #{@status}" elsif @stalled_days result << "Stalled by inactivity: #{@stalled_days} days" end result.join(', ') end |
#stalled? ⇒ Boolean
16 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 16 def stalled? = @stalled_days || stalled_by_status? |
#stalled_by_status? ⇒ Boolean
20 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 20 def stalled_by_status? = (@status && !@status_is_blocking) |
#state ⇒ Object
26 27 28 |
# File 'lib/jirametrics/blocked_stalled_change.rb', line 26 def state instance_variables.map { |variable| instance_variable_get variable } end |