2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								class Checksum
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  attr_reader :hash_type, :hexdigest
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-23 18:13:48 +02:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  alias to_s hexdigest
							 | 
						
					
						
							
								
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2016-09-17 15:17:27 +01:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  TYPES = [:sha256].freeze
							 | 
						
					
						
							
								
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-07 00:49:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  def initialize(hash_type, hexdigest)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    @hash_type = hash_type
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    @hexdigest = hexdigest
							 | 
						
					
						
							
								
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  def empty?
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-07 00:49:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								    hexdigest.empty?
							 | 
						
					
						
							
								
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								
							 | 
						
					
						
							
								
									
										
										
										
											2013-04-07 00:49:56 -05:00
										 
									 
								 
							 | 
							
								
									
										
									
								
							 | 
							
								
							 | 
							
							
								  def ==(other)
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								    hash_type == other.hash_type && hexdigest == other.hexdigest
							 | 
						
					
						
							
								
									
										
										
										
											2012-06-18 19:58:35 -05:00
										 
									 
								 
							 | 
							
								
							 | 
							
								
							 | 
							
							
								  end
							 | 
						
					
						
							| 
								
							 | 
							
								
							 | 
							
								
							 | 
							
							
								end
							 |