Sha256: 4d7aef13ab9285c2c4b107889bfef828c476a4ae3d1ab617c2aa4af85e785b88

Contents?: true

Size: 469 Bytes

Versions: 4

Compression:

Stored size: 469 Bytes

Contents

# frozen_string_literal: true

require_relative "spiker/version"

# Spiker is a simple spike generator.
module Spiker
  class Error < StandardError; end

  def self.classify(str)
    str.split(/[^A-Za-z0-0]/).map(&:capitalize).join
  end

  def self.snake_case(str)
    # lifted from ActiveSupport inflectors
    str.gsub(/::/, "/")
       .gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
       .gsub(/([a-z\d])([A-Z])/, '\1_\2')
       .tr("-", "_")
       .downcase
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
spiker-0.1.5 lib/spiker.rb
spiker-0.1.4 lib/spiker.rb
spiker-0.1.3 lib/spiker.rb
spiker-0.1.2 lib/spiker.rb