device_detector_regexes
所属分类:collect
开发工具:Ruby
文件大小:0KB
下载次数:0
上传日期:2022-01-03 19:14:53
上 传 者:
sh-1993
说明: 用于podigee设备检测器的简单扩展器,
(Simple extender for podigee devicedetector,)
文件列表:
.rubocop.yml (69, 2020-03-18)
CHANGELOG.md (328, 2020-03-18)
CODE_OF_CONDUCT.md (3232, 2020-03-18)
Gemfile (70, 2020-03-18)
Gemfile.lock (840, 2020-03-18)
LICENSE.txt (1085, 2020-03-18)
Rakefile (226, 2020-03-18)
bin/ (0, 2020-03-18)
bin/console (389, 2020-03-18)
bin/setup (131, 2020-03-18)
device_detector_regexes.gemspec (1489, 2020-03-18)
lib/ (0, 2020-03-18)
lib/device_detector_regexes.rb (1229, 2020-03-18)
lib/device_detector_regexes/ (0, 2020-03-18)
lib/device_detector_regexes/version.rb (84, 2020-03-18)
test/ (0, 2020-03-18)
test/device_detector_test.rb (703, 2020-03-18)
test/fixtures/ (0, 2020-03-18)
test/fixtures/regexes/ (0, 2020-03-18)
test/fixtures/regexes/bots.yml (50, 2020-03-18)
test/fixtures/regexes/client/ (0, 2020-03-18)
test/fixtures/regexes/client/browser_engine.yml (50, 2020-03-18)
test/fixtures/regexes/client/browsers.yml (50, 2020-03-18)
test/fixtures/regexes/client/feed_readers.yml (50, 2020-03-18)
test/fixtures/regexes/client/libraries.yml (50, 2020-03-18)
test/fixtures/regexes/client/mediaplayers.yml (50, 2020-03-18)
test/fixtures/regexes/client/mobile_apps.yml (176, 2020-03-18)
test/fixtures/regexes/client/pim.yml (50, 2020-03-18)
test/fixtures/regexes/device/ (0, 2020-03-18)
test/fixtures/regexes/device/cameras.yml (50, 2020-03-18)
test/fixtures/regexes/device/car_browsers.yml (50, 2020-03-18)
test/fixtures/regexes/device/consoles.yml (50, 2020-03-18)
test/fixtures/regexes/device/mobiles.yml (51, 2020-03-18)
test/fixtures/regexes/device/portable_media_player.yml (50, 2020-03-18)
test/fixtures/regexes/device/televisions.yml (50, 2020-03-18)
test/fixtures/regexes/oss.yml (164, 2020-03-18)
test/fixtures/regexes/vendorfragments.yml (50, 2020-03-18)
test/test_helper.rb (177, 2020-03-18)
... ...
# DeviceDetectorRegexes
DeviceDetectorRegexes is a simple extender for [device_detector](https://github.com/podigee/device_detector) gem that makes it easy to add new regular expressions
## Installation
Add this line to your application's Gemfile:
```ruby
gem 'device_detector_regexes'
```
And then execute:
$ bundle install
Or install it yourself as:
$ gem install device_detector_regexes
## Usage
Map device_detector [regexes folder](https://github.com/podigee/device_detector/tree/develop/regexes) into your custom folder
```ruby
DeviceDetector.configure do |config|
config.dir = "path/to/your/custom/folder"
end
```
Add new regexes to the appropriate file
```yaml
# your/custom/folder/regexes/client/mobile_apps.yml
# [] # leave an empty array here if the file is empty
- regex: 'Foo(?:[ /]([\d\.]+))'
name: 'Bar'
version: '$1'
prefix: false # do not append piwik dd prefix
```
```ruby
client = DeviceDetector.new("Foo/2.1.2; Android: 9; Model:PAR-LX1; okhttp/3.12.8")
client.name # => "Bar"
client.full_version # => "2.1.2"
```
## License
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
## Code of Conduct
Everyone interacting in the DeviceDetectorRegexes project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/karpinovsky/device_detector_regexes/blob/master/CODE_OF_CONDUCT.md).
近期下载者:
相关文件:
收藏者: