lib/wcc/contentful/helpers.rb in wcc-contentful-0.1.0 vs lib/wcc/contentful/helpers.rb in wcc-contentful-0.2.0
- old
+ new
@@ -23,6 +23,12 @@
string_array.reduce do |l, s|
l = l.chop while l != s[0...l.length]
l
end
end
+
+ def content_type_from_constant(const)
+ return const.content_type if const.respond_to?(:content_type)
+ name = const.try(:name) || const.to_s
+ name.demodulize.camelize(:lower)
+ end
end