open os family method
zlx opened this issue · 4 comments
Hi, @peteygao
Great gem, I want to replace user_agent.
But I face a small problem now, I want to get os.family and find it private.
Do you have plan to open the information? Thank you very much.
@zlx Sorry, can you explain what you mean by "replace user_agent"?
Do you mean something like?:
device = DeviceDetector.new "user agent string"
...
device.update_user_agent "new user agent string"
There is currently no plans for supporting such an operation, you can simply new
up a new instance of DeviceDetector for your new user_agent.
As for your second question, you can use client.os_name
to get the OS Family name. e.g.:
client = DeviceDetector.new "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:42.0) Gecko/20100101 Firefox/42.0"
client.os_name # => 'Mac'
@peteygao I'm sorry make you confuse. I just mean use this gem replace UserAgent, which I used to detect os and browser before.
And now I want to direct get os family by
client.os.family
but it raise
NoMethodError: private method `os' called for #DeviceDetector:0x007ff4bb618200
I want to know Do you have plan to open the information? Thank you very much.