Sha256: 1ba6955530ca8eed43f04faae5d4354ab6e43e747a31abe7b7ed15e9b69a77fd

Contents?: true

Size: 580 Bytes

Versions: 2

Compression:

Stored size: 580 Bytes

Contents

require 'space2underscore/version'

module Space2underscore
  class << self
    def convert(argv)
      argv.length == 1 ? argv[0].strip.gsub(/\s/,  '_') : argv.join('_')
    end

    def generate_command(underscore_include_sentence)
      "echo #{underscore_include_sentence} | ruby -pe 'chomp' | #{copy_cmd}"
    end

    def copy_cmd
      if system("type pbcopy > /dev/null 2>&1")
        "pbcopy"
      elsif system("type xsel > /dev/null 2>&1")
        "xsel --input --clipboard"
      elsif system("type xclip > /dev/null 2>&1")
        "xclip"
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
space2underscore-0.1.9 lib/space2underscore.rb
space2underscore-0.1.8 lib/space2underscore.rb