mirror of
				https://github.com/KevinMidboe/linguist.git
				synced 2025-10-29 17:50:22 +00:00 
			
		
		
		
	Update api example
This commit is contained in:
		
							
								
								
									
										12
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										12
									
								
								README.md
									
									
									
									
									
								
							@@ -30,19 +30,15 @@ Features
 | 
			
		||||
Usage
 | 
			
		||||
-----
 | 
			
		||||
 | 
			
		||||
    file = Linguist::SourceFile.new("linguist.rb")
 | 
			
		||||
    file = Linguist::Blob.new("linguist.rb")
 | 
			
		||||
    file.language.name #=> "Ruby"
 | 
			
		||||
 | 
			
		||||
    file = Linguist::SourceFile.new("linguist.gem")
 | 
			
		||||
    file = Linguist::Blob.new("linguist.gem")
 | 
			
		||||
    file.binary? #=> true
 | 
			
		||||
 | 
			
		||||
    project = Linguist::Project.new(".")
 | 
			
		||||
    project = Linguist::Repository.new(".")
 | 
			
		||||
    project.language.name  #=> "Ruby"
 | 
			
		||||
    project.language_stats #=> { "Ruby" => 0.98, "Shell" => 0.02 }
 | 
			
		||||
 | 
			
		||||
    # Using Grit backend
 | 
			
		||||
    repo = Grit::Repo.new("./.git")
 | 
			
		||||
    project = Linguist::Project.new(repo)
 | 
			
		||||
    project.languages      #=> { "Ruby" => 0.98, "Shell" => 0.02 }
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Contributing
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user