opto-model 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/opto/model/attribute_declaration.rb +10 -0
- data/lib/opto/model/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d7c83427e75851b3d86750010b5b8f3ffffc81c8
|
4
|
+
data.tar.gz: 9a231b97d7c15fe3aa59592b0b511d5d79faefc0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a01e85569e88ef783986e3eab9ba32fff3705413ab903bf0fff8e54778bc91840da6af6d26fe4592a001dcf4dc0433995587d0416f3e37a630424f8a75d53e8
|
7
|
+
data.tar.gz: 34aa891072f587807d09852345eab957d03466d79c9ae22451b9b42f25c289db6f9eaa21c639f548cdace75170115e9978371207b130b373ead8a26c4ae70ef0
|
@@ -15,12 +15,22 @@ module Opto
|
|
15
15
|
if attribute_definitions.find { |d| d[:name] == name }
|
16
16
|
raise RuntimeError, "Duplicate attribute '#{name}'"
|
17
17
|
end
|
18
|
+
if type.to_sym == :boolean
|
19
|
+
arguments.merge!(as: "boolean")
|
20
|
+
end
|
21
|
+
|
18
22
|
attribute_definitions << arguments.merge(name: name, type: type)
|
19
23
|
|
20
24
|
define_method "#{name}_handler" do
|
21
25
|
collection[name].handler
|
22
26
|
end
|
23
27
|
|
28
|
+
if type.to_sym == :boolean
|
29
|
+
define_method "#{name}?" do
|
30
|
+
collection[name].value
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
24
34
|
define_method name do
|
25
35
|
collection[name].value
|
26
36
|
end
|
data/lib/opto/model/version.rb
CHANGED