Sha256: 3a4a2126a3ef9a17d8e3329199c936925ee743a4e23e6bbc1302b529ae23d2a8

Contents?: true

Size: 652 Bytes

Versions: 77

Compression:

Stored size: 652 Bytes

Contents

#!/usr/bin/env ruby

require 'tins/go'
include Tins::GO
require 'tins/xt/string'

$opts = go 'bdts'

string  = ARGV.shift or fail "need a class/filepath/filename"

def underscore(string)
  string = string.sub(/.*::/, '') if $opts['b']
  string = string.underscore
  $opts['s'] and string << '.rb'
  print string
end

def camelize(string)
  string = File.basename(string) if $opts['b']
  string = string.gsub(/#{Regexp.quote(File.extname(string))}\Z/, '')
  print string.camelize
end

case
when $opts['t']
  if string[0, 1] =~ /[A-Z]/
    underscore string
  else
    camelize string
  end
when $opts['d']
  underscore string
else
  camelize string
end

Version data entries

77 entries across 77 versions & 1 rubygems

Version Path
utils-0.2.4 bin/classify
utils-0.2.3 bin/classify
utils-0.2.2 bin/classify
utils-0.2.1 bin/classify
utils-0.2.0 bin/classify
utils-0.1.1 bin/classify
utils-0.1.0 bin/classify
utils-0.0.100 bin/classify
utils-0.0.99 bin/classify
utils-0.0.98 bin/classify
utils-0.0.97 bin/classify
utils-0.0.96 bin/classify
utils-0.0.95 bin/classify
utils-0.0.94 bin/classify
utils-0.0.93 bin/classify
utils-0.0.92 bin/classify
utils-0.0.91 bin/classify
utils-0.0.90 bin/classify
utils-0.0.89 bin/classify
utils-0.0.88 bin/classify