ImChatParser
需求来源
Installation
Add this line to your application's Gemfile:
gem 'im-chat-parser'
Usage
require 'im-chat-parser'
# single: 表示 QQ 单人对话
# multiple: 表示 QQ 多人群对话
chat = ImChatParser.load('文本文件绝对路径')
chat.lines.length
# Get all chat lines
lines = chat.lines
# Get each chat line user
user = chat.lines[0]
user.names
user.qq_num
# Get all chat users
users = chat.users
users[0].qq_num
users[0].names
Contributing
- Fork it ( https://github.com/[my-github-username]/im-chat-parser/fork )
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create a new Pull Request