gossiper 0.5.1 → 0.5.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1f4ccef0f1edaa89456ae3bb1f0b3a7b45bb3fb4
|
4
|
+
data.tar.gz: fa4e83cff30b4b91f75a4a8976dff890cc4d81a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b7936bca7c35e763fa8de2ba5dfd207e4ce22d8359980c1e4bd289c8c0fff6ba3f6be6d386b701ba2f1c4b2fc2505a9b13509d924d1068fbb460bed3ad4f91c7
|
7
|
+
data.tar.gz: ed5435e238255b2b3e0b53b46c7071bc2fe636880a2c039d7cd16cad8f5678e3ffc58a4ad8ca1e5d62b9caf2f8533e0b5cebda0c05d27cb8e50de9dc43f49f44
|
data/lib/gossiper.rb
CHANGED
@@ -2,6 +2,7 @@ require "gossiper/engine"
|
|
2
2
|
require "gossiper/concerns/models/notification"
|
3
3
|
require "gossiper/concerns/models/user_notification"
|
4
4
|
require "gossiper/concerns/models/email_settings"
|
5
|
+
require "gossiper/concerns/models/dynamic_attributes"
|
5
6
|
require "gossiper/concerns/decorators/notification"
|
6
7
|
require "gossiper/mailer"
|
7
8
|
require "gossiper/configuration"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module Gossiper
|
2
|
+
module Concerns
|
3
|
+
module Models
|
4
|
+
module DynamicAttributes
|
5
|
+
extend ActiveSupport::Concern
|
6
|
+
|
7
|
+
included do
|
8
|
+
serialize :dynamic_attributes, JSON
|
9
|
+
end
|
10
|
+
|
11
|
+
module ClassMethods
|
12
|
+
def dynamic_attributes(*args)
|
13
|
+
args.each do |method|
|
14
|
+
|
15
|
+
# dynamic getters
|
16
|
+
define_method method do
|
17
|
+
dynamic_attribute_get(method)
|
18
|
+
end
|
19
|
+
|
20
|
+
# dynamic setters
|
21
|
+
define_method "#{method}=" do |value|
|
22
|
+
dynamic_attribute_set(method, value)
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def dynamic_attribute_set(name, value)
|
29
|
+
self.dynamic_attributes = dynamic_attributes.merge({ name.to_s => value })
|
30
|
+
end
|
31
|
+
|
32
|
+
def dynamic_attribute_get(name)
|
33
|
+
self.dynamic_attributes[name.to_s]
|
34
|
+
end
|
35
|
+
|
36
|
+
def dynamic_attributes
|
37
|
+
read_attribute(:dynamic_attributes).presence || {}
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/lib/gossiper/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gossiper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Marcelo Jacobus
|
@@ -203,6 +203,7 @@ files:
|
|
203
203
|
- app/controllers/gossiper/application_controller.rb
|
204
204
|
- config/routes.rb
|
205
205
|
- config/locales/en.bootstrap.yml
|
206
|
+
- db/migrate/20140304160545_add_dynamic_attributes_to_gossiper_notifications.rb
|
206
207
|
- db/migrate/20140304131816_remove_kind_from_gossiper_notifications.rb
|
207
208
|
- db/migrate/20140304111323_add_to_to_gossiper_notifications.rb
|
208
209
|
- db/migrate/20131206162038_create_gossiper_notifications.rb
|
@@ -223,6 +224,7 @@ files:
|
|
223
224
|
- lib/gossiper/engine.rb
|
224
225
|
- lib/gossiper/concerns/decorators/notification.rb
|
225
226
|
- lib/gossiper/concerns/models/email_settings.rb
|
227
|
+
- lib/gossiper/concerns/models/dynamic_attributes.rb
|
226
228
|
- lib/gossiper/concerns/models/notification.rb
|
227
229
|
- lib/gossiper/concerns/models/user_notification.rb
|
228
230
|
- lib/gossiper/mailer.rb
|