Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update entities compare method #215

Merged
merged 1 commit into from
Nov 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/pubid/nist/edition.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Pubid::Nist
class Edition
class Edition < Pubid::Core::Entity
attr_accessor :year, :month, :day, :parsed, :sequence

def initialize(parsed: nil, year: nil, month: nil, day: nil, sequence: nil)
Expand Down
6 changes: 1 addition & 5 deletions lib/pubid/nist/publisher.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"../../../publishers.yaml"))

module Pubid::Nist
class Publisher
class Publisher < Pubid::Core::Entity
attr_accessor :publisher

def initialize(publisher:)
Expand All @@ -17,10 +17,6 @@ def to_s(format = :short)
PUBLISHERS[format.to_s][@publisher]
end

def ==(other)
other.publisher == @publisher
end

def self.publishers_keys
PUBLISHERS["long"].keys
end
Expand Down
2 changes: 1 addition & 1 deletion lib/pubid/nist/stage.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
STAGES = YAML.load_file(File.join(File.dirname(__FILE__), "../../../stages.yaml"))

module Pubid::Nist
class Stage
class Stage < Pubid::Core::Entity
attr_accessor :id, :type

def initialize(id:, type:)
Expand Down
2 changes: 1 addition & 1 deletion lib/pubid/nist/update.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Pubid::Nist
class Update
class Update < Pubid::Core::Entity
attr_accessor :number, :year, :month

def initialize(number: nil, year: nil, month: nil)
Expand Down
2 changes: 1 addition & 1 deletion pubid-nist.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ Gem::Specification.new do |spec|
spec.add_dependency "thor"
spec.add_dependency "lightly"
spec.add_dependency "parslet"
spec.add_dependency "pubid-core", "~> 1.10.4"
spec.add_dependency "pubid-core", "~> 1.11.0"
spec.add_dependency "rubyzip"
end
11 changes: 11 additions & 0 deletions spec/nist_pubid/identifier_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -954,4 +954,15 @@
described_class.parse("NIST SP 260-162 2006ed.").weight
end
end

describe "#==" do
context "when identifiers equal" do
let(:id1) { described_class.parse("NIST SP 800-66r2 IPD") }
let(:id2) { described_class.parse("NIST SP 800-66r2 IPD") }

it "should return equal" do
expect(id1).to eq(id2)
end
end
end
end