lib/wcc/contentful/helpers.rb in wcc-contentful-0.2.1 vs lib/wcc/contentful/helpers.rb in wcc-contentful-0.2.2
- old
+ new
@@ -1,6 +1,5 @@
-
# frozen_string_literal: true
module WCC::Contentful::Helpers
extend self
@@ -14,10 +13,10 @@
raise ArgumentError, "Unknown content type '#{value.dig('sys', 'type') || 'null'}'"
end
end
def constant_from_content_type(content_type)
- content_type.camelize.gsub(/[^_a-zA-Z0-9]/, '_')
+ content_type.gsub(/[^_a-zA-Z0-9]/, '_').camelize
end
def shared_prefix(string_array)
string_array.reduce do |l, s|
l = l.chop while l != s[0...l.length]