kudos 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kudos/configuration.rb +12 -0
- data/lib/kudos/version.rb +1 -1
- data/lib/kudos.rb +17 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 794f0cfa50b1a522d89d6d5bbe5ad3c22699bbe96c2c8eaf0a3249558a946aec
|
4
|
+
data.tar.gz: 60e25e21ff551fa92d3feac2c683ed2040869d636df99bb3def1936787977ec7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0aead887db0291c2729485680c81fb0d7e46bf401c439ccf6c2e64440d81d8f0a69fc261d0c92628a1f8b8686d10cc4fe2ee63a30835d9337abe76c15080187c
|
7
|
+
data.tar.gz: d45687689fd6c3f403c64a518dded792ad59901c009a31529b52a8960caa7228de8e4524500fdaffe3df4c4abe6a266747dae309f004ab7ae620a6bf5f9476ec
|
data/lib/kudos/version.rb
CHANGED
data/lib/kudos.rb
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'kudos/version'
|
4
4
|
require 'kudos/engine'
|
5
|
+
require 'kudos/configuration'
|
5
6
|
|
6
7
|
module Kudos
|
7
8
|
def self.included(base)
|
@@ -11,6 +12,21 @@ module Kudos
|
|
11
12
|
end
|
12
13
|
|
13
14
|
module ClassMethods
|
15
|
+
# Public: Configure kudos.
|
16
|
+
#
|
17
|
+
# Kudos.configure do |config|
|
18
|
+
# config.achievements_model_name = ::Achievement
|
19
|
+
# end
|
20
|
+
#
|
21
|
+
def configure
|
22
|
+
yield configuration
|
23
|
+
end
|
24
|
+
|
25
|
+
# Public: Returns Kudos::Configuration instance.
|
26
|
+
def configuration
|
27
|
+
@configuration ||= Configuration.new
|
28
|
+
end
|
29
|
+
|
14
30
|
def awards
|
15
31
|
@awards ||= {}
|
16
32
|
end
|
@@ -20,7 +36,7 @@ module Kudos
|
|
20
36
|
end
|
21
37
|
|
22
38
|
def award(award_name, *attributes)
|
23
|
-
achievements =
|
39
|
+
achievements = configuration.achievements_model_name.where(award_name: award_name).order(rank: :asc)
|
24
40
|
awards[award_name].call(achievements, *attributes)
|
25
41
|
end
|
26
42
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kudos
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bogdanov Anton
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-12-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -162,6 +162,7 @@ files:
|
|
162
162
|
- lib/generators/kudos/templates/users_achievement.erb
|
163
163
|
- lib/generators/kudos/templates/uuidable.erb
|
164
164
|
- lib/kudos.rb
|
165
|
+
- lib/kudos/configuration.rb
|
165
166
|
- lib/kudos/engine.rb
|
166
167
|
- lib/kudos/version.rb
|
167
168
|
- lib/tasks/kudos_tasks.rake
|