scriber 0.0.3 → 0.0.4
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.
- data/VERSION +1 -1
- data/lib/scriber/scribe.rb +5 -9
- data/lib/scriber.rb +1 -12
- data/scriber.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.4
|
data/lib/scriber/scribe.rb
CHANGED
@@ -11,20 +11,16 @@ module Scriber
|
|
11
11
|
rescue UnknownRecord
|
12
12
|
end
|
13
13
|
end
|
14
|
-
|
15
|
-
|
14
|
+
|
15
|
+
attributes :klass, :type, :data
|
16
|
+
validates_presence_of :klass, :type
|
16
17
|
|
17
18
|
def play
|
18
|
-
klass.scribe_play(type, data)
|
19
|
+
klass.constantize.scribe_play(type, data)
|
19
20
|
end
|
20
21
|
|
21
22
|
def klass=(klass)
|
22
|
-
|
23
|
-
klass = klass.constantize
|
24
|
-
end
|
25
|
-
write_attribute(:klass, klass)
|
26
|
-
rescue NameError
|
27
|
-
write_attribute(:klass, nil)
|
23
|
+
write_attribute(:klass, klass.to_s)
|
28
24
|
end
|
29
25
|
end
|
30
26
|
end
|
data/lib/scriber.rb
CHANGED
@@ -7,19 +7,8 @@ require "supermodel"
|
|
7
7
|
|
8
8
|
module Scriber
|
9
9
|
class ScriberError < StandardError; end
|
10
|
-
|
11
|
-
def disabled?
|
12
|
-
@disabled
|
13
|
-
end
|
14
|
-
|
15
|
-
def disable(&block)
|
16
|
-
@disabled = true
|
17
|
-
yield
|
18
|
-
@disabled = false
|
19
|
-
end
|
20
10
|
|
21
|
-
def record(klass, type, data)
|
22
|
-
return if disabled?
|
11
|
+
def record(klass, type, data = nil)
|
23
12
|
Scribe.create({
|
24
13
|
:klass => klass,
|
25
14
|
:type => type,
|
data/scriber.gemspec
CHANGED