Sha256: 4905c9d8673bf100e161c9777adc57305fdf34e2192b236ed3c0b3af5e44964e

Contents?: true

Size: 570 Bytes

Versions: 1

Compression:

Stored size: 570 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(space_include_sentence)
      "echo #{space_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

1 entries across 1 versions & 1 rubygems

Version Path
space2underscore-0.1.7 lib/space2underscore.rb