ruby_reportable 0.4.1 → 0.4.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 536fc58a8672343c53cbe20116d38f21a88e12b7
4
- data.tar.gz: d4569ed9acd976c4f77572a22c02c22f644615ec
3
+ metadata.gz: effff5f0aa5831dc7975c1e4e4aa00254e86f8ee
4
+ data.tar.gz: 793f07f4c7d9a1e44ab07a45abecd190dcb25936
5
5
  SHA512:
6
- metadata.gz: ed6b34325043147e672966a1eb10db12afe6563787b62157f0fe2f7c5ae06f330183efc2aaac4fcb76a9b254879ed8d2ea9636acb15214d9d0d85a2842ff3001
7
- data.tar.gz: dd3543f110217752f0415a7bc2003c9b894299b2839f7640d1545b531ee6702e2479050e97e9cfa13ff1b32d78701c2a4ea27a36ddff05c7748340fe929d850f
6
+ metadata.gz: d7f1a8f31e08ccc91df8bb4d689fec211d1aafbbe9f09859a248a415f3622779c38de4b62cd461942dbbf9eb619f5d18ce8a66a8b5fd1cebb7867c14b8f38be5
7
+ data.tar.gz: d8ef115a80db54548a33a594a0d283be240b6d893531f48a4cd48c5beca7393de3c811e2d5ddc03bdb7540d897f94707789a18fdcf38789948eb3f08a53bd1be
@@ -10,6 +10,8 @@ module RubyReportable
10
10
  @data_source = nil
11
11
  @report = self.to_s
12
12
  @category = 'Reports'
13
+ @allow_group = true
14
+ @allow_sort = true
13
15
  @meta = {}
14
16
  @benchmarks = {}
15
17
  @records_returned = 0
@@ -53,6 +55,22 @@ module RubyReportable
53
55
  end
54
56
  end
55
57
 
58
+ def allow_group(string = nil)
59
+ if string.nil?
60
+ @allow_group
61
+ else
62
+ @allow_group = string
63
+ end
64
+ end
65
+
66
+ def allow_sort(string = nil)
67
+ if string.nil?
68
+ @allow_sort
69
+ else
70
+ @allow_sort = string
71
+ end
72
+ end
73
+
56
74
  def category(string = nil)
57
75
  if string.nil?
58
76
  @category
@@ -158,8 +176,14 @@ module RubyReportable
158
176
  else
159
177
  sort = [sort] unless sort.is_a?(Array)
160
178
 
161
- data.sort_by {|element| sort.map {|column| element[column]} }
179
+ #data.sort_by {|element| sort.map {|column| element[column]} }
180
+ sort.map.each do |element|
181
+ parts = data.partition { |d| d[element].blank? }
182
+ sorted = parts.last.sort { |a,b| a[element] <=> b[element] }
183
+ data = sorted + parts.first
184
+ end
162
185
  end
186
+ return data
163
187
  end
164
188
 
165
189
  def _group(group, data, options = {})
@@ -1,3 +1,3 @@
1
1
  module RubyReportable
2
- VERSION = "0.4.1"
2
+ VERSION = "0.4.2"
3
3
  end
@@ -5,6 +5,7 @@ Gem::Specification.new do |s|
5
5
  s.name = "ruby_reportable"
6
6
  s.version = RubyReportable::VERSION
7
7
  s.platform = Gem::Platform::RUBY
8
+ s.license = 'MIT'
8
9
  s.authors = ["John 'asceth' Long"]
9
10
  s.email = ["machinist@asceth.com"]
10
11
  s.homepage = "http://github.com/asceth/ruby_reportable"
@@ -21,4 +22,3 @@ Gem::Specification.new do |s|
21
22
  s.add_development_dependency 'rspec'
22
23
  s.add_development_dependency 'rr'
23
24
  end
24
-
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby_reportable
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.1
4
+ version: 0.4.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - John 'asceth' Long
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-07-01 00:00:00.000000000 Z
11
+ date: 2013-07-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
@@ -74,7 +74,8 @@ files:
74
74
  - spec/source_spec.rb
75
75
  - spec/spec_helper.rb
76
76
  homepage: http://github.com/asceth/ruby_reportable
77
- licenses: []
77
+ licenses:
78
+ - MIT
78
79
  metadata: {}
79
80
  post_install_message:
80
81
  rdoc_options: []