metricky 0.8.5 → 0.8.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +4 -0
- data/lib/metricky/base.rb +2 -0
- data/lib/metricky/period.rb +1 -0
- data/lib/metricky/ranges.rb +4 -4
- data/lib/metricky/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6eff06cb4dfd69f667b2a14fec7a746bb40368339892cfe860073e019294111c
|
4
|
+
data.tar.gz: 6cef6b56e4f2a207759bbff46b8e458b2ab389c565a6351bae4b6cfc96adb858
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d4c81b96bc4d112b95920eda1026585c4298eec62197b4c50fc8ccb69b4f501ecfa8c9ffab1983a67125c8d7fb608e16fc32d0ee58bfe54dabfdeffff13fb48
|
7
|
+
data.tar.gz: 76de9ca8b123ff4fb8892349ea0e28beb446a65d4d8072ee01e4c7166d549f03c0b99f15b4cdee8aa5a2a8ba80a2f7233a9ea55f198ebdb9a589c8c81b3f3681
|
data/README.md
CHANGED
@@ -1,6 +1,10 @@
|
|
1
1
|
# Metricky
|
2
2
|
Display metrics about your database in your application. Depends on the awesome [Chartkick](https://github.com/ankane/chartkick) and [Groupdate](https://github.com/ankane/groupdate).
|
3
3
|
|
4
|
+
## Demo (with code!)
|
5
|
+
|
6
|
+
[metricky-demo.herokuapp.com](https://metricky-demo.herokuapp.com)
|
7
|
+
|
4
8
|
## Usage
|
5
9
|
|
6
10
|
Make this in Ruby:
|
data/lib/metricky/base.rb
CHANGED
@@ -122,6 +122,8 @@ module Metricky
|
|
122
122
|
end
|
123
123
|
if period? && valid_period?
|
124
124
|
@query = @query.group_by_period(period, period_column)
|
125
|
+
elsif period?
|
126
|
+
raise NameError, "period #{period} is not a valid period. Must be one of #{Groupdate::PERIODS}."
|
125
127
|
end
|
126
128
|
if group?
|
127
129
|
@query = @query.group(group)
|
data/lib/metricky/period.rb
CHANGED
data/lib/metricky/ranges.rb
CHANGED
@@ -13,7 +13,7 @@ module Metricky
|
|
13
13
|
# range_priority '24h', 99
|
14
14
|
# end
|
15
15
|
def self.range_priority(key, priority)
|
16
|
-
self.ranges[key.
|
16
|
+
self.ranges[key.to_sym].priority = priority
|
17
17
|
end
|
18
18
|
|
19
19
|
# Register a range. Priority is used for the select order.
|
@@ -33,7 +33,7 @@ module Metricky
|
|
33
33
|
def self.register_range(key, label: nil, priority: nil, &block)
|
34
34
|
label ||= key
|
35
35
|
priority ||= self.ranges.size
|
36
|
-
self.ranges[key.
|
36
|
+
self.ranges[key.to_sym] = RangeThing.new(label, priority, block)
|
37
37
|
end
|
38
38
|
|
39
39
|
# Removes the listed ranges from the select
|
@@ -42,7 +42,7 @@ module Metricky
|
|
42
42
|
end
|
43
43
|
|
44
44
|
def self.remove_range(key)
|
45
|
-
self.ranges.delete(key.
|
45
|
+
self.ranges.delete(key.to_sym)
|
46
46
|
end
|
47
47
|
|
48
48
|
# Remove all ranges
|
@@ -84,7 +84,7 @@ module Metricky
|
|
84
84
|
# Lookup the passed range and convert it to a value for our ActiveRecord query
|
85
85
|
def range_to_value
|
86
86
|
return nil if range.nil?
|
87
|
-
if val = self.ranges[range]
|
87
|
+
if val = self.ranges[range.to_sym]
|
88
88
|
val.value.call
|
89
89
|
else
|
90
90
|
raise TypeError, "invalid range #{range}. Please define it."
|
data/lib/metricky/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: metricky
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.8.
|
4
|
+
version: 0.8.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josh Brody
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-09-
|
11
|
+
date: 2019-09-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|