Class: IssueLink
Instance Attribute Summary collapse
-
#origin ⇒ Object
readonly
Returns the value of attribute origin.
- #other_issue ⇒ Object
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
Instance Method Summary collapse
- #direction ⇒ Object
-
#initialize(origin:, raw:) ⇒ IssueLink
constructor
A new instance of IssueLink.
- #inspect ⇒ Object
- #inward? ⇒ Boolean
- #label ⇒ Object
- #name ⇒ Object
- #outward? ⇒ Boolean
Constructor Details
#initialize(origin:, raw:) ⇒ IssueLink
Returns a new instance of IssueLink.
9 10 11 12 |
# File 'lib/jirametrics/issue_link.rb', line 9 def initialize origin:, raw: @origin = origin @raw = raw end |
Instance Attribute Details
#origin ⇒ Object (readonly)
Returns the value of attribute origin.
6 7 8 |
# File 'lib/jirametrics/issue_link.rb', line 6 def origin @origin end |
#other_issue ⇒ Object
14 15 16 17 18 19 |
# File 'lib/jirametrics/issue_link.rb', line 14 def other_issue if @other_issue.nil? @other_issue = Issue.new(raw: (inward? ? raw['inwardIssue'] : raw['outwardIssue']), board: origin.board) end @other_issue end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw.
6 7 8 |
# File 'lib/jirametrics/issue_link.rb', line 6 def raw @raw end |
Instance Method Details
#direction ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/jirametrics/issue_link.rb', line 21 def direction assert_jira_behaviour_false(raw['inwardIssue'].nil? && raw['outwardIssue'].nil?) do "Found an issue link with neither inward nor outward references: #{raw}" end assert_jira_behaviour_false(raw['inwardIssue'] && raw['outwardIssue']) do "Found an issue link that has both inward and outward references in the same link: #{raw}" end if raw['inwardIssue'] :inward else :outward end end |
#inspect ⇒ Object
56 57 58 59 |
# File 'lib/jirametrics/issue_link.rb', line 56 def inspect "IssueLink(origin=#{origin.key}, other=#{other_issue.key}, direction=#{direction}, " \ "label=#{label.inspect}, name=#{name.inspect}" end |
#inward? ⇒ Boolean
36 37 38 |
# File 'lib/jirametrics/issue_link.rb', line 36 def inward? direction == :inward end |
#label ⇒ Object
44 45 46 47 48 49 50 |
# File 'lib/jirametrics/issue_link.rb', line 44 def label if inward? @raw['type']['inward'] else @raw['type']['outward'] end end |
#name ⇒ Object
52 53 54 |
# File 'lib/jirametrics/issue_link.rb', line 52 def name @raw['type']['name'] end |
#outward? ⇒ Boolean
40 41 42 |
# File 'lib/jirametrics/issue_link.rb', line 40 def outward? direction == :outward end |