Class: Hanami::Action::Mime::RequestMimeWeight Private

Inherits:
Object
  • Object
show all
Includes:
Comparable
Defined in:
lib/hanami/action/mime.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(mime, quality, index, format = mime) ⇒ RequestMimeWeight

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of RequestMimeWeight.

Since:

  • 1.0.1



599
600
601
602
# File 'lib/hanami/action/mime.rb', line 599

def initialize(mime, quality, index, format = mime)
  @quality, @index, @format = quality, index, format
  calculate_priority(mime)
end

Instance Attribute Details

#formatObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



591
592
593
# File 'lib/hanami/action/mime.rb', line 591

def format
  @format
end

#indexObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



583
584
585
# File 'lib/hanami/action/mime.rb', line 583

def index
  @index
end

#mimeObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



587
588
589
# File 'lib/hanami/action/mime.rb', line 587

def mime
  @mime
end

#priorityObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



595
596
597
# File 'lib/hanami/action/mime.rb', line 595

def priority
  @priority
end

#qualityObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



579
580
581
# File 'lib/hanami/action/mime.rb', line 579

def quality
  @quality
end

Instance Method Details

#<=>(other) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Since:

  • 1.0.1



606
607
608
609
# File 'lib/hanami/action/mime.rb', line 606

def <=>(other)
  return priority <=> other.priority unless priority == other.priority
  other.index <=> index
end