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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1fc7b5de1ee0451180c3feaff2750f695a26d5bf
4
- data.tar.gz: 543ccd54e891ada07f9ab714b0aea8eba9e3d64d
3
+ metadata.gz: d7c83427e75851b3d86750010b5b8f3ffffc81c8
4
+ data.tar.gz: 9a231b97d7c15fe3aa59592b0b511d5d79faefc0
5
5
  SHA512:
6
- metadata.gz: b0f32f636e27fecddc30cd3e92f48819d8ae6328694d0571fd5f062bd5c7839977691d9a6eec1c6a437f7c715f19fd4b4b16b5314bec16b4922516a16ba24840
7
- data.tar.gz: a6916ed85314f65bd798c744f75e8b92254fd51eabe74d5f46cad492a7b4890608a142df3a4b88432877a6108011c6de47ef795fa51327f21748b4ae3a3a71e4
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
@@ -1,5 +1,5 @@
1
1
  module Opto
2
2
  module Model
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: opto-model
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Kimmo Lehto