lib/wcc/blogs/post.rb in wcc-blogs-client-0.3.0 vs lib/wcc/blogs/post.rb in wcc-blogs-client-0.3.1
- old
+ new
@@ -66,13 +66,11 @@
define_camelcase_alias(
'date'
) do |camelcase|
value = raw[camelcase]
- return unless value && value.length
-
- Time.parse(value)
+ Time.parse(value) if value && value.length
end
define_camelcase_alias(
'author',
'hero_image',
@@ -80,12 +78,12 @@
) do |camelcase|
OpenStruct.new(raw[camelcase]) if raw[camelcase]
end
define_camelcase_alias('publishing_targets') do |camelcase|
- return [] unless raw[camelcase]
+ targets = raw[camelcase] || []
- raw[camelcase].map { |val| OpenStruct.new(val) if val }
+ targets.map { |val| OpenStruct.new(val) if val }
end
alias cache_key digest
end
end