mirror of
				https://github.com/scinote-eln/scinote-web.git
				synced 2025-10-31 08:26:31 +08:00 
			
		
		
		
	
		
			
				
	
	
		
			11 lines
		
	
	
	
		
			228 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
			
		
		
	
	
			11 lines
		
	
	
	
		
			228 B
		
	
	
	
		
			Ruby
		
	
	
	
	
	
| class JsonbHashSerializer
 | |
|   def self.dump(hash)
 | |
|     hash.nil? ? '{}' : hash.to_json
 | |
|   end
 | |
| 
 | |
|   def self.load(hash)
 | |
|     hash ||= {}
 | |
|     hash = JSON.parse(hash) if hash.instance_of? String
 | |
|     hash.with_indifferent_access
 | |
|   end
 | |
| end
 |