Sha256: b8b7449abc14e2370cd5c7e2d7a5dbb6688973e8a791baac9188e311b469179f

Contents?: true

Size: 548 Bytes

Versions: 1

Compression:

Stored size: 548 Bytes

Contents

require 'caseconv/cli'
require 'active_support/core_ext/string'

class ::String
  def camelize_dfl
    camelize.sub(/^[A-Z]/) { |c| c.downcase}
  end

  def kebab
    underscore.gsub(/_/, '-')
  end
end

module Caseconv
  class App
    def main(args)
      Caseconv::Cli.start(args)
    rescue StandardError => e
      STDERR.puts(e.message)
    end

    def convert_file(file, case_type)
      file.map do |line|
        convert(line.chomp, case_type)
      end
    end

    def convert(str, case_type)
      str.send(case_type)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
caseconv-0.1.0 lib/caseconv/app.rb