acts_as_dynamic 0.0.2 → 0.0.3
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/lib/acts_as_dynamic.rb +1 -1
- data/lib/acts_as_dynamic/base.rb +40 -0
- data/lib/acts_as_dynamic/object.rb +13 -0
- data/lib/acts_as_dynamic/version.rb +17 -0
- metadata +6 -3
data/lib/acts_as_dynamic.rb
CHANGED
@@ -0,0 +1,40 @@
|
|
1
|
+
# ActsAsDynamic
|
2
|
+
module ActsAsDynamic
|
3
|
+
|
4
|
+
# Base
|
5
|
+
module Base
|
6
|
+
|
7
|
+
# <methods>
|
8
|
+
|
9
|
+
# Builder
|
10
|
+
def initialize args = {}
|
11
|
+
args.each_pair do |attribute, value|
|
12
|
+
self.send "#{attribute}=", value
|
13
|
+
end
|
14
|
+
self
|
15
|
+
end
|
16
|
+
|
17
|
+
# Metaclass
|
18
|
+
def metaclass
|
19
|
+
class << self
|
20
|
+
self
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
# Method missing
|
25
|
+
def method_missing(attribute, value = "")
|
26
|
+
# Assignation?
|
27
|
+
if attribute.to_s["="]
|
28
|
+
# Adding attribute
|
29
|
+
metaclass.send :attr_accessor, attribute.to_s[/[^=]+/]
|
30
|
+
self.send attribute, value
|
31
|
+
else
|
32
|
+
nil
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
# </methods>
|
37
|
+
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: acts_as_dynamic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 25
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 3
|
10
|
+
version: 0.0.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Juan Colacelli
|
@@ -28,6 +28,9 @@ extra_rdoc_files: []
|
|
28
28
|
|
29
29
|
files:
|
30
30
|
- lib/acts_as_dynamic.rb
|
31
|
+
- lib/acts_as_dynamic/base.rb
|
32
|
+
- lib/acts_as_dynamic/version.rb
|
33
|
+
- lib/acts_as_dynamic/object.rb
|
31
34
|
homepage: https://github.com/juancolacelli/acts_as_dynamic
|
32
35
|
licenses:
|
33
36
|
- MIT
|