Class: Banzai::Filter::References::DesignReferenceFilter::Identifier

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/banzai/filter/references/design_reference_filter.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(issue_iid:, filename:) ⇒ Identifier

Returns a new instance of Identifier.


11
12
13
14
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 11

def initialize(issue_iid:, filename:)
  @issue_iid = issue_iid
  @filename = filename
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.


9
10
11
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 9

def filename
  @filename
end

#issue_iidObject (readonly)

Returns the value of attribute issue_iid.


9
10
11
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 9

def issue_iid
  @issue_iid
end

Instance Method Details

#<=>(other) ⇒ Object


23
24
25
26
27
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 23

def <=>(other)
  return unless other.is_a?(Identifier)

  [issue_iid, filename] <=> [other.issue_iid, other.filename]
end

#as_composite_id(id_for_iid) ⇒ Object


16
17
18
19
20
21
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 16

def as_composite_id(id_for_iid)
  id = id_for_iid[issue_iid]
  return unless id

  { issue_id: id, filename: filename }
end

#hashObject


30
31
32
# File 'lib/banzai/filter/references/design_reference_filter.rb', line 30

def hash
  [issue_iid, filename].hash
end