Sha256: 1a5af646d36b66147bf60f57bf9ff74c2cf51de4b2644756424e9dcdd17bd617

Contents?: true

Size: 411 Bytes

Versions: 1

Compression:

Stored size: 411 Bytes

Contents

module PGit
  module Helpers
    module StringExtensions
      def letter?(letter)
        match(/^#{letter}$/i)
      end

      def index?
        match(/^[1-9][0-9]*$/)
      end

      def yes?
        letter?('y')
      end

      def no?
        letter?('n')
      end

      def cancel?
        letter?('c')
      end
    end
  end
end

String.class_eval do
  include PGit::Helpers::StringExtensions
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
pgit-1.0.0 lib/pgit/helpers/string_extensions.rb