myslog 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,4 +1,40 @@
1
1
  myslog
2
2
  ======
3
3
 
4
- MySQL slow query log parser
4
+ MySQL slow query log parser
5
+
6
+ Install
7
+ -------
8
+
9
+ ```
10
+ gem install myslog
11
+ ```
12
+
13
+ Usage
14
+ -----
15
+
16
+ ```ruby
17
+ myslog = MySlog.new
18
+
19
+ f = open("mysql-slow-query.log")
20
+ lines = f.read.split("\n")
21
+ f.close
22
+
23
+ logs = myslog.parse(lines)
24
+ ```
25
+
26
+ `logs` is Array of Hash
27
+
28
+ ```ruby
29
+ log = logs.first
30
+
31
+ log[:date]
32
+ log[:user]
33
+ log[:host]
34
+ log[:host_ip]
35
+ log[:query_time]
36
+ log[:lock_time]
37
+ log[:rows_sent]
38
+ log[:rows_examined]
39
+ log[:sql]
40
+ ```
data/lib/myslog.rb CHANGED
@@ -22,8 +22,6 @@ class MySlog
22
22
  divide(lines).map {|record| parse_record(record) }
23
23
  end
24
24
 
25
- protected
26
-
27
25
  def divide(lines)
28
26
  records = []
29
27
 
data/myslog.gemspec CHANGED
@@ -12,6 +12,6 @@ Gem::Specification.new do |gem|
12
12
  gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
13
13
  gem.name = "myslog"
14
14
  gem.require_paths = ["lib"]
15
- gem.version = "0.0.1"
15
+ gem.version = "0.0.2"
16
16
  gem.add_development_dependency "rspec"
17
17
  end
data/spec/myslog.rb CHANGED
@@ -62,7 +62,7 @@ use webtie;
62
62
  describe "#divide" do
63
63
 
64
64
  it "should return Array of Array" do
65
- results = @myslog.send(:divide, @lines)
65
+ results = @myslog.divide(@lines)
66
66
  results.should be_an_instance_of Array
67
67
  results.each do |result|
68
68
  results.should be_an_instance_of Array
@@ -70,7 +70,7 @@ use webtie;
70
70
  end
71
71
 
72
72
  it "should devide lines in set of records" do
73
- results = @myslog.send(:divide, @lines)
73
+ results = @myslog.divide(@lines)
74
74
 
75
75
  record = results[0]
76
76
  record.size.should == 12
@@ -102,7 +102,7 @@ use webtie;
102
102
  "# Time: 0 Lock_time: 0 Rows_sent: 1 Rows_examined: 1",
103
103
  "use webtie;"
104
104
  ]
105
- response = @myslog.send(:parse_record, lines)
105
+ response = @myslog.parse_record(lines)
106
106
 
107
107
  response.should be_an_instance_of Hash
108
108
  %w[
@@ -128,7 +128,7 @@ use webtie;
128
128
  "# Query_time: #{@query_time} Lock_time: #{@lock_time} Rows_sent: #{@rows_sent} Rows_examined: #{@rows_examined}",
129
129
  @sql
130
130
  ]
131
- @response = @myslog.send(:parse_record, @lines)
131
+ @response = @myslog.parse_record(@lines)
132
132
  end
133
133
 
134
134
  it "should have expected values" do
@@ -161,7 +161,7 @@ use webtie;
161
161
  "# Query_time: #{@query_time} Lock_time: #{@lock_time} Rows_sent: #{@rows_sent} Rows_examined: #{@rows_examined}",
162
162
  @sql
163
163
  ]
164
- @response = @myslog.send(:parse_record, @lines)
164
+ @response = @myslog.parse_record(@lines)
165
165
  end
166
166
 
167
167
  it "should have expected values" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: myslog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-06-07 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec
16
- requirement: &70118056303180 !ruby/object:Gem::Requirement
16
+ requirement: &70279301611840 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,7 +21,7 @@ dependencies:
21
21
  version: '0'
22
22
  type: :development
23
23
  prerelease: false
24
- version_requirements: *70118056303180
24
+ version_requirements: *70279301611840
25
25
  description: MySQL slow query parser.
26
26
  email:
27
27
  - taka84u9@gmail.com