Sha256: d5be28f3f6f43943c12061217f828e4d7e2d9d224433f8bda3ca5b840492b789

Contents?: true

Size: 472 Bytes

Versions: 3

Compression:

Stored size: 472 Bytes

Contents

class String
  # Create a camelcase version of the name that is passed.
  def camelcase
    self.split('_').map{|e| e.capitalize}.join
  end
end

class Templater::Generator

  def underscore
    self.name.gsub(/::/, '/').
      gsub(/([A-Z]+)([A-Z][a-z])/,'\1_\2').
      gsub(/([a-z\d])([A-Z])/, '\1_\2').
      tr("-","_").
      downcase
  end

  def migration_name
    "create_#{self.name}s"
  end

  def migration_time
    Time.now.strftime("%Y%m%d%H%M%S")
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
sweetsie-0.1.1 lib/sweetsie/generators/helper.rb
sweetsie-0.1.0 lib/sweetsie/generators/helper.rb
sweetsie-0.0.2 lib/sweetsie/generators/helper.rb