freyja 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/lib/freyja/base.rb CHANGED
@@ -68,11 +68,15 @@ class Freyja::Base
68
68
  else
69
69
  value = source[attr]
70
70
  end
71
- if association[:class] && value.present?
72
- translator = association[:class].new(value)
73
- result[attr] = translator.as_json
71
+ if value.present?
72
+ if association[:class]
73
+ translator = association[:class].new(value)
74
+ result[attr] = translator.as_json
75
+ else
76
+ result[attr] = value
77
+ end
74
78
  else
75
- result[attr] = value
79
+ # TODO
76
80
  end
77
81
  end
78
82
  end
@@ -87,13 +91,17 @@ class Freyja::Base
87
91
  else
88
92
  value = source[attr]
89
93
  end
90
- if association[:class] && value.present?
91
- result[attr] = value.map do |v|
92
- translator = association[:class].new(v)
93
- translator.as_json
94
+ if value.present?
95
+ if association[:class]
96
+ result[attr] = value.map do |v|
97
+ translator = association[:class].new(v)
98
+ translator.as_json
99
+ end
100
+ else
101
+ result[attr] = value
94
102
  end
95
103
  else
96
- result[attr] = value
104
+ # TODO
97
105
  end
98
106
  end
99
107
  end
@@ -1,3 +1,3 @@
1
1
  module Freyja
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: freyja
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: