dymos 0.2.1 → 0.2.2

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5ba92ec5ad7a14cc2a8a2290558dc84803396a74
4
- data.tar.gz: bf890a934267cfe7aee6aa06408f9fc3412c7ada
3
+ metadata.gz: 4c246a1228f4ef98b4e464d5d96baed0110d1ba1
4
+ data.tar.gz: 91a67b4c79e361b7691db2c397e3249767024413
5
5
  SHA512:
6
- metadata.gz: a376e42a0ade618cec85b5606bc7f15d71551a5fa70f9645c5f99bc41a6b2c274d1ee12c40bbf68cb6086729d915cee7fd5f71e7793225d050b9635255f7dbe9
7
- data.tar.gz: 6da39b940196b74d02df13df03cbd1567b28792dece6139483cf0d241b6363464fb1525c76c6c3b984f9c35ed8ec2b009e19c77f4a3a2d18eed7da492af41edf
6
+ metadata.gz: 5c117aa6a02e90ec45e10e55abd146c1a0535ccd12250c356136f24a3c661a89e64ffd05958cb231e766387f81b49df24f80ac21724e402e9db7b116c818a8ca
7
+ data.tar.gz: 6c81c795420bc400f3b18faa74a485f6b6bbf8ce4a3f1bde63de0170025f7709f76ddd01db51041236fcc8d09e5a44e582b973815727f2a3a93bc3b3f1a103c0
@@ -54,7 +54,8 @@ module Dymos
54
54
  @fields ||= {}
55
55
  @fields[attr]={
56
56
  type: type,
57
- default: default
57
+ default: default,
58
+ desc:desc
58
59
  }
59
60
  define_attribute_methods attr
60
61
 
@@ -76,7 +77,9 @@ module Dymos
76
77
  end
77
78
 
78
79
  }
80
+ define_singleton_method("#{attr}_type") { type }
79
81
  define_method("#{attr}_type") { type }
82
+ define_singleton_method("#{attr}_desc") { desc }
80
83
  define_method("#{attr}_desc") { desc }
81
84
  define_method("#{attr}?") do
82
85
  val = self.send attr
@@ -115,7 +118,7 @@ module Dymos
115
118
 
116
119
  def attributes(raw=false)
117
120
  attrs = {}
118
- @attributes.keys.each do |name|
121
+ self.class.fields.keys.each do |name|
119
122
  attrs[name] = send "#{name}", raw if respond_to? "#{name}"
120
123
  end
121
124
  attrs
@@ -1,3 +1,3 @@
1
1
  module Dymos
2
- VERSION = "0.2.1"
2
+ VERSION = "0.2.2"
3
3
  end
@@ -174,7 +174,16 @@ describe Dymos::Model do
174
174
  describe :attributes do
175
175
  it 'まとめて取得' do
176
176
  model = DummyUser.new(sample_user_hash)
177
- expect(model.attributes).to eq(sample_user_hash)
177
+ expect(model.attributes).to eq(
178
+ id:'hoge',
179
+ name:'太郎',
180
+ email:'hoge@example.net',
181
+ list:Set['a', 'b', 'c'],
182
+ count:10,
183
+ enable:false,
184
+ created_at:nil,
185
+ updated_at:nil
186
+ )
178
187
  end
179
188
  end
180
189
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dymos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - hoshina85
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-11-13 00:00:00.000000000 Z
11
+ date: 2014-11-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler