lib/support/string.rb
def camelcase_and_namespace
        if  self.count("_")  >= 1 || self.count('-') >=1
          delimiters = Regexp.union(['-', '_'])
          n,c= self.split(delimiters).then { |first, *rest| [first.tap {|s| s[0] = s[0].upcase}, rest.map(&:capitalize).join]  }
          ## if base is the first part of the type-name, probably Arcade::Base is choosen a namespace. thats wrong
          namespace_present = unless n == 'Base'
                                Object.const_get(n)  rescue  false # Database.namespace
                              else 
                                false
          end
          # if no namespace is found, leave it empty and return the capitalized string as class name
          namespace_present && !c.nil? ? [namespace_present,c] : [Database.namespace, n+c]
        else
          [ Database.namespace, self.capitalize ]
        end
      end
#modified version of
# https://stackoverflow.com/questions/63769351/convert-string-to-camel-case-in-ruby
# returns an Array [ Namespace(first character upcase)  , Type(class, camelcase) ]
#
#  if the namespace is not found, joins all string-parts


if the namespace is not found, joins all string-parts
if the namespace is not found joins all string - parts
def camelcase_and_namespace
        if  self.count("_")  >= 1 || self.count('-') >=1
          delimiters = Regexp.union(['-', '_'])
          n,c= self.split(delimiters).then { |first, *rest| [first.tap {|s| s[0] = s[0].upcase}, rest.map(&:capitalize).join]  }
          namespace_present = unless n == 'Base'
                                Object.const_get(n)  rescue  false 
                              else 
                                false
          end
          namespace_present && !c.nil? ? [namespace_present,c] : [Database.namespace, n+c]
        else
          [ Database.namespace, self.capitalize ]
        end
      end
def camelcase_and_namespace if self . count ( "_" ) >= 1 || self . count ( '-' ) >= 1 delimiters = Regexp . union ( [ '-' , '_' ] ) n , c = self . split ( delimiters ) . then { | first , * rest | [ first . tap { | s | s [ 0 ] = s [ 0 ] . upcase } , rest . map ( & :capitalize ) . join ] } namespace_present = unless n == 'Base' Object . const_get ( n ) rescue false else false end namespace_present && ! c . nil? ? [ namespace_present , c ] : [ Database . namespace , n + c ] else [ Database . namespace , self . capitalize ] end end
modified version of
https://stackoverflow.com/questions/63769351/convert-string-to-camel-case-in-ruby
returns an Array [ Namespace(first character upcase)  , Type(class, camelcase) ]
modified version of https : // stackoverflow . com / questions / 63769351 / convert - string - to - camel - case - in - ruby returns an Array [ Namespace ( first character upcase ) Type ( class camelcase ) ]
## if base is the first part of the type-name, probably Arcade::Base is choosen a namespace. thats wrong # Database.namespace # if no namespace is found, leave it empty and return the capitalized string as class name