| 
									
										
										
										
											2015-09-24 15:06:02 +03:00
										 |  |  | class String | 
					
						
							|  |  |  |   def present? | 
					
						
							|  |  |  |     !empty? | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def blank? | 
					
						
							|  |  |  |     empty? | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2016-01-19 18:06:09 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  |   # from ActiveSupport | 
					
						
							|  |  |  |   def underscore | 
					
						
							|  |  |  |     gsub(/::/, '/'). | 
					
						
							|  |  |  |     gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2'). | 
					
						
							|  |  |  |     gsub(/([a-z\d])([A-Z])/,'\1_\2'). | 
					
						
							|  |  |  |     tr("-", "_"). | 
					
						
							|  |  |  |     downcase | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   def underscore_class | 
					
						
							|  |  |  |     split('::').last.underscore | 
					
						
							|  |  |  |   end | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   # rough simplification | 
					
						
							|  |  |  |   def pluralize | 
					
						
							|  |  |  |     "#{self}s" | 
					
						
							|  |  |  |   end | 
					
						
							| 
									
										
										
										
											2015-09-24 15:06:02 +03:00
										 |  |  | end |