Class: Fuzz::Entry

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/fuzz/entry.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(title:, object:, weight:) ⇒ Entry

Returns a new instance of Entry.



7
8
9
10
11
# File 'lib/fuzz/entry.rb', line 7

def initialize(title:, object:, weight:)
  @title = title
  @object = object
  @weight = weight
end

Instance Attribute Details

#objectObject (readonly)

Returns the value of attribute object.



5
6
7
# File 'lib/fuzz/entry.rb', line 5

def object
  @object
end

#titleObject (readonly)

Returns the value of attribute title.



5
6
7
# File 'lib/fuzz/entry.rb', line 5

def title
  @title
end

#weightObject (readonly)

Returns the value of attribute weight.



5
6
7
# File 'lib/fuzz/entry.rb', line 5

def weight
  @weight
end

Instance Method Details

#<=>(other) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/fuzz/entry.rb', line 13

def <=>(other)
  other_weight = other.weight

  if weight != other_weight
    other_weight <=> weight
  else
    title <=> other.title
  end
end