Sha256: ba6c33c2ee929c002605dea1d6cc26c5a4aa171f1c44d686699966a8dd2f5b91

Contents?: true

Size: 296 Bytes

Versions: 1

Compression:

Stored size: 296 Bytes

Contents

# frozen_string_literal: true

module Space2underscore
  class Underscore
    def initialize(sentence)
      @sentence = sentence
    end

    def convert
      if @sentence.length == 1
        @sentence[0].strip.gsub(/\s/, '_')
      else
        @sentence.join('_')
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
space2underscore-0.5.3 lib/space2underscore/underscore.rb