nano-store 0.3.14 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/nano_store/model.rb +8 -20
- data/lib/nano_store/version.rb +1 -1
- metadata +4 -4
data/lib/nano_store/model.rb
CHANGED
@@ -17,26 +17,6 @@ module NanoStore
|
|
17
17
|
raise NanoStoreError, error_ptr[0].description if error_ptr[0]
|
18
18
|
self
|
19
19
|
end
|
20
|
-
|
21
|
-
def method_missing(method, *args)
|
22
|
-
matched = method.to_s.match(/^([^=]+)(=)?$/)
|
23
|
-
name = matched[1]
|
24
|
-
modifier = matched[2]
|
25
|
-
|
26
|
-
if self.class.attributes.include?(name.to_sym)
|
27
|
-
if modifier == "="
|
28
|
-
if args[0].nil?
|
29
|
-
self.info.delete(name.to_sym)
|
30
|
-
else
|
31
|
-
self.info[name.to_sym] = args[0]
|
32
|
-
end
|
33
|
-
else
|
34
|
-
self.info[name.to_sym]
|
35
|
-
end
|
36
|
-
else
|
37
|
-
super
|
38
|
-
end
|
39
|
-
end
|
40
20
|
end
|
41
21
|
|
42
22
|
module ModelClassMethods
|
@@ -59,6 +39,14 @@ module NanoStore
|
|
59
39
|
|
60
40
|
def attribute(name)
|
61
41
|
@attributes << name
|
42
|
+
|
43
|
+
define_method(name) do |*args, &block|
|
44
|
+
self.info[name]
|
45
|
+
end
|
46
|
+
|
47
|
+
define_method((name + "=").to_sym) do |*args, &block|
|
48
|
+
self.info[name] = args[0]
|
49
|
+
end
|
62
50
|
end
|
63
51
|
|
64
52
|
def attributes
|
data/lib/nano_store/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nano-store
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-10-
|
12
|
+
date: 2012-10-07 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bubble-wrap
|
@@ -190,7 +190,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
190
190
|
version: '0'
|
191
191
|
segments:
|
192
192
|
- 0
|
193
|
-
hash: -
|
193
|
+
hash: -2617493902001633964
|
194
194
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
195
195
|
none: false
|
196
196
|
requirements:
|
@@ -199,7 +199,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
199
199
|
version: '0'
|
200
200
|
segments:
|
201
201
|
- 0
|
202
|
-
hash: -
|
202
|
+
hash: -2617493902001633964
|
203
203
|
requirements: []
|
204
204
|
rubyforge_project:
|
205
205
|
rubygems_version: 1.8.24
|