attrio 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -12,7 +12,7 @@ module Attrio
12
12
  def self.define_accessor(klass, type, options)
13
13
  unless klass.method_defined?(options[:method_name])
14
14
  if type.present?
15
- self.define_typecasted_method(klass, type, options)
15
+ self.define_typecasting_method(klass, type, options)
16
16
  else
17
17
  klass.send :attr_writer, options[:method_name].chop
18
18
  end
@@ -21,13 +21,13 @@ module Attrio
21
21
  end
22
22
  end
23
23
 
24
- def self.define_typecasted_method(klass, type, options)
24
+ def self.define_typecasting_method(klass, type, options)
25
25
  klass.send :define_method, options[:method_name] do |value|
26
26
  if !value.nil?
27
27
  value = if type.respond_to?(:typecast) && type.respond_to?(:typecasted?)
28
28
  type.typecasted?(value) ? value : type.typecast(*[value, options])
29
29
  else
30
- type.new(value)
30
+ type == Hash && value.is_a?(Hash) ? value : type.new(value)
31
31
  end
32
32
  end
33
33
 
@@ -4,7 +4,7 @@ module Attrio
4
4
  module Version
5
5
  MAJOR = 0
6
6
  MINOR = 4
7
- PATCH = 0
7
+ PATCH = 1
8
8
  BUILD = nil
9
9
 
10
10
  STRING = [MAJOR, MINOR, PATCH, BUILD].compact.join('.')
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: attrio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.4.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -10,11 +10,11 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2013-06-24 00:00:00.000000000 Z
13
+ date: 2013-06-27 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: rspec
17
- requirement: &70339309557080 !ruby/object:Gem::Requirement
17
+ requirement: &70232928034320 !ruby/object:Gem::Requirement
18
18
  none: false
19
19
  requirements:
20
20
  - - ! '>='
@@ -22,10 +22,10 @@ dependencies:
22
22
  version: '0'
23
23
  type: :development
24
24
  prerelease: false
25
- version_requirements: *70339309557080
25
+ version_requirements: *70232928034320
26
26
  - !ruby/object:Gem::Dependency
27
27
  name: webmock
28
- requirement: &70339309556540 !ruby/object:Gem::Requirement
28
+ requirement: &70232928033780 !ruby/object:Gem::Requirement
29
29
  none: false
30
30
  requirements:
31
31
  - - ~>
@@ -33,10 +33,10 @@ dependencies:
33
33
  version: 1.9.0
34
34
  type: :development
35
35
  prerelease: false
36
- version_requirements: *70339309556540
36
+ version_requirements: *70232928033780
37
37
  - !ruby/object:Gem::Dependency
38
38
  name: simplecov
39
- requirement: &70339309572460 !ruby/object:Gem::Requirement
39
+ requirement: &70232928033240 !ruby/object:Gem::Requirement
40
40
  none: false
41
41
  requirements:
42
42
  - - ! '>='
@@ -44,10 +44,10 @@ dependencies:
44
44
  version: '0'
45
45
  type: :development
46
46
  prerelease: false
47
- version_requirements: *70339309572460
47
+ version_requirements: *70232928033240
48
48
  - !ruby/object:Gem::Dependency
49
49
  name: coveralls
50
- requirement: &70339309572000 !ruby/object:Gem::Requirement
50
+ requirement: &70232928032580 !ruby/object:Gem::Requirement
51
51
  none: false
52
52
  requirements:
53
53
  - - ! '>='
@@ -55,10 +55,10 @@ dependencies:
55
55
  version: '0'
56
56
  type: :development
57
57
  prerelease: false
58
- version_requirements: *70339309572000
58
+ version_requirements: *70232928032580
59
59
  - !ruby/object:Gem::Dependency
60
60
  name: rake
61
- requirement: &70339309571560 !ruby/object:Gem::Requirement
61
+ requirement: &70232928048240 !ruby/object:Gem::Requirement
62
62
  none: false
63
63
  requirements:
64
64
  - - ! '>='
@@ -66,10 +66,10 @@ dependencies:
66
66
  version: '0'
67
67
  type: :development
68
68
  prerelease: false
69
- version_requirements: *70339309571560
69
+ version_requirements: *70232928048240
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: bundler
72
- requirement: &70339309571120 !ruby/object:Gem::Requirement
72
+ requirement: &70232928046760 !ruby/object:Gem::Requirement
73
73
  none: false
74
74
  requirements:
75
75
  - - ! '>='
@@ -77,7 +77,7 @@ dependencies:
77
77
  version: '0'
78
78
  type: :development
79
79
  prerelease: false
80
- version_requirements: *70339309571120
80
+ version_requirements: *70232928046760
81
81
  description:
82
82
  email: hello@jetrockets.ru
83
83
  executables: []
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
151
151
  version: '0'
152
152
  segments:
153
153
  - 0
154
- hash: 2234961798158657284
154
+ hash: 1677394698442050783
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  none: false
157
157
  requirements:
@@ -160,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
160
160
  version: '0'
161
161
  segments:
162
162
  - 0
163
- hash: 2234961798158657284
163
+ hash: 1677394698442050783
164
164
  requirements: []
165
165
  rubyforge_project:
166
166
  rubygems_version: 1.8.15