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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 72cbcfe379b8654dabeeb81b7fcba95c0bece993a4855fb7661370f0a2cfbb0b
4
- data.tar.gz: 7d371afad102bc958349c48a972258a39f8b8b6a949958797d1d7953eaffd84c
3
+ metadata.gz: 6eff06cb4dfd69f667b2a14fec7a746bb40368339892cfe860073e019294111c
4
+ data.tar.gz: 6cef6b56e4f2a207759bbff46b8e458b2ab389c565a6351bae4b6cfc96adb858
5
5
  SHA512:
6
- metadata.gz: 3c6d36c3dc61b972d8b7b43ffa8777ba2b95d1d8c78de5e3a55618a8ae3cfac372595d7071e9422fea5133a4a27c11140836774525105f751b54c29c55793f8f
7
- data.tar.gz: 013543bff0eb26e7f0b2f92f7fcb8ce70ffafad2aef717ba7f628bd9d06384b47c05fec0afe6073758645679f160d678205a0970e7814d78c6212b11e5aeba06
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:
@@ -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)
@@ -23,6 +23,7 @@ module Metricky
23
23
  deprecate_and_alias_method :period?, :trend?
24
24
 
25
25
  def valid_period?
26
+ return true unless period?
26
27
  Groupdate::PERIODS.include?(period.to_sym)
27
28
  end
28
29
  deprecate_and_alias_method :valid_period?, :valid_trend?
@@ -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.to_s].priority = priority
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.to_s] = RangeThing.new(label, priority, block)
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.to_s)
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."
@@ -1,3 +1,3 @@
1
1
  module Metricky
2
- VERSION = '0.8.5'
2
+ VERSION = '0.8.6'
3
3
  end
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.5
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-10 00:00:00.000000000 Z
11
+ date: 2019-09-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails