lib/wcc/contentful/indexed_representation.rb in wcc-contentful-1.2.0 vs lib/wcc/contentful/indexed_representation.rb in wcc-contentful-1.2.1
- old
+ new
@@ -107,13 +107,11 @@
Link
Asset
].freeze
def type=(raw_type)
- unless TYPES.include?(raw_type)
- raise ArgumentError, "Unknown type #{raw_type}, expected one of: #{TYPES}"
- end
+ raise ArgumentError, "Unknown type #{raw_type}, expected one of: #{TYPES}" unless TYPES.include?(raw_type)
@type = raw_type
end
def initialize(hash_or_id = nil)
@@ -129,12 +127,10 @@
return
end
if raw_type = hash_or_id.delete('type')
raw_type = raw_type.to_sym
- unless TYPES.include?(raw_type)
- raise ArgumentError, "Unknown type #{raw_type}, expected one of: #{TYPES}"
- end
+ raise ArgumentError, "Unknown type #{raw_type}, expected one of: #{TYPES}" unless TYPES.include?(raw_type)
@type = raw_type
end
hash_or_id.each { |k, v| public_send("#{k}=", v) }