lib/ezid/identifier.rb in ezid-client-1.1.0 vs lib/ezid/identifier.rb in ezid-client-1.1.1

- old
+ new

@@ -10,16 +10,16 @@ attr_accessor :id, :shoulder, :metadata, :state private :state, :state=, :id= # Attributes to display on inspect - INSPECT_ATTRS = %w( id status target created ) + INSPECT_ATTRS = %w( id status target created ).freeze # EZID status terms - PUBLIC = "public" - RESERVED = "reserved" - UNAVAILABLE = "unavailable" + PUBLIC = "public".freeze + RESERVED = "reserved".freeze + UNAVAILABLE = "unavailable".freeze class << self attr_accessor :defaults # Creates or mints an identifier (depending on arguments) @@ -168,10 +168,12 @@ # @param reason [String] an optional reason # @return [String] the new status def unavailable!(reason = nil) raise Error, "Cannot make a reserved identifier unavailable." if persisted? && reserved? value = UNAVAILABLE - value << " | #{reason}" if reason + if reason + value += " | #{reason}" + end self.status = value end # Mark the identifier as public # @return [String] the new status