I'm trying to use the Linguist gem: https://github.com/github/linguist
My code is:
require 'linguist'
filePath = ARGV
langDetails = Linguist::FileBlob.new(filePath)
puts langDetails
That outputs: #<Linguist::FileBlob:0x007faf93b17200>
However, when I do puts langDetails.language
, I get
/Users/myuser/.rvm/gems/ruby-1.9.3-p545@linguist/gems/github-linguist-2.10.15/lib/linguist/file_blob.rb:39:in `stat': can't convert Array into String (TypeError)
from /Users/myuser/.rvm/gems/ruby-1.9.3-p545@linguist/gems/github-linguist-2.10.15/lib/linguist/file_blob.rb:39:in `mode'
from /Users/myuser/.rvm/gems/ruby-1.9.3-p545@linguist/gems/github-linguist-2.10.15/lib/linguist/blob_helper.rb:294:in `language'
from ./linguist.rb:9:in `<main>'
I'm not entirely sure what I'm doing wrong. Ideally I want the data back as a JSON object. How do I accomplish this?