Skip to content

Commit

Permalink
Removed <=> operator on ExtensionPresence. Doesn't seem to be needed …
Browse files Browse the repository at this point in the history
…anyways (looked at code to see if using it and looked at output artifacts).
  • Loading branch information
james-ball-qualcomm committed Dec 19, 2024
1 parent 3b84826 commit afcc7f8
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 15 deletions.
19 changes: 5 additions & 14 deletions lib/arch_obj_models/extension.rb
Original file line number Diff line number Diff line change
Expand Up @@ -625,19 +625,6 @@ def ==(other)
end
end

# @overload <=>(other)
# @param other [String] A presence string
# @return [Integer] Sort alphabetically by presence, then alphabetically by optional_type
def <=>(other)
raise ArgumentError, "ExtensionPresence is only comparable to other ExtensionPresence classes" unless other.is_a?(ExtensionPresence)

if @presence != other.presence
@presence <=> other.presence
else
@optional_type <=> other.optional_type
end
end

######################################################
# Following comparison operators follow these rules:
# - "mandatory" is greater than "optional"
Expand Down Expand Up @@ -695,8 +682,12 @@ class ExtensionRequirement
# @return [Array<RequirementSpec>] Set of requirement specifications
def requirement_specs = @requirements

def requirement_specs_to_s
"#{@requirements.map(&:to_s).join(', ')}"
end

def to_s
"#{name} #{@requirements.map(&:to_s).join(', ')}"
"#{name} " + requirement_specs_to_s
end

# @return [Extension] The extension that this requirement is for
Expand Down
2 changes: 1 addition & 1 deletion lib/arch_obj_models/profile.rb
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ def ext_req_to_adoc(ext_req)
ext = cfg_arch.extension(ext_req.name)
ret << "* *#{ext_req.name}* " + (ext.nil? ? "" : ext.long_name)
ret << "+"
ret << "Version #{ext_req.requirement_specs}"
ret << "Version #{ext_req.requirement_specs_to_s}"

ret
end
Expand Down

0 comments on commit afcc7f8

Please sign in to comment.