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.0.87 bin/classify
utils-0.0.86 bin/classify
utils-0.0.85 bin/classify
utils-0.0.84 bin/classify
utils-0.0.83 bin/classify
utils-0.0.82 bin/classify
utils-0.0.81 bin/classify
utils-0.0.80 bin/classify
utils-0.0.79 bin/classify
utils-0.0.78 bin/classify
utils-0.0.77 bin/classify
utils-0.0.76 bin/classify
utils-0.0.75 bin/classify
utils-0.0.74 bin/classify
utils-0.0.73 bin/classify
utils-0.0.72 bin/classify
utils-0.0.71 bin/classify
utils-0.0.70 bin/classify
utils-0.0.69 bin/classify
utils-0.0.68 bin/classify