-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Call super in ObjectFile subclass initializer
Also make method signatures match, because that's what good subclasses do.
- Loading branch information
Showing
4 changed files
with
21 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
module PreAssembly | ||
class ObjectFile < Assembly::ObjectFile | ||
attr_accessor :relative_path, :exclude_from_content | ||
attr_reader :checksum | ||
include ActiveModel::AttributeMethods | ||
attr_accessor :exclude_from_content | ||
alias_attribute :checksum, :provider_md5 | ||
|
||
def initialize(params = {}) | ||
@path = params[:path] | ||
@relative_path = params[:relative_path] | ||
self.checksum = params[:checksum] | ||
@exclude_from_content = params[:exclude_from_content] | ||
end | ||
|
||
def checksum=(value) | ||
@checksum = value | ||
self.provider_md5 = value # this is an attribute of the Assembly::ObjectFile class | ||
# @param [String] path full path | ||
# @param [Hash<Symbol => Object>] params | ||
# @see Assembly::ObjectFile, Assembly::ObjectFileable | ||
def initialize(path, params = {}) | ||
super | ||
@provider_md5 ||= params[:checksum] | ||
@exclude_from_content = params[:exclude_from_content] || false | ||
end | ||
|
||
# This is a bit of a lie. ObjectFiles with the same relative_path but different checksums | ||
# are clearly not representing the same thing. | ||
def <=>(other) | ||
@relative_path <=> other.relative_path | ||
relative_path <=> other.relative_path | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters