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

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/banzai/filter/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.


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

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

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename


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

def filename
  @filename
end

#issue_iidObject (readonly)

Returns the value of attribute issue_iid


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

def issue_iid
  @issue_iid
end

Instance Method Details

#<=>(other) ⇒ Object


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

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

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

#as_composite_id(id_for_iid) ⇒ Object


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

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

  { issue_id: id, filename: filename }
end

#hashObject


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

def hash
  [issue_iid, filename].hash
end