Sha256: ea6c0a1558714c5f207d655f3ff9c88a1f47773a7b6030520839dd33e09da6a2

Contents?: true

Size: 413 Bytes

Versions: 10

Compression:

Stored size: 413 Bytes

Contents

module LogCabin
  module Modules
    ##
    # Use regex to adjust state value
    module Regex
      def regex_helper(value)
        return value unless @find
        fail("Value does not match regex: #{value}") unless value.match(@find)
        value.sub(@find, @replace)
      end

      private

      def regex(find, replace = '\1')
        @find = find
        @replace = replace
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
prospectus-0.0.12 lib/prospectus/helpers/regex.rb
prospectus-0.0.11 lib/prospectus/helpers/regex.rb
prospectus-0.0.10 lib/prospectus/helpers/regex.rb
prospectus-0.0.9 lib/prospectus/helpers/regex.rb
prospectus-0.0.8 lib/prospectus/helpers/regex.rb
prospectus-0.0.6 lib/prospectus/helpers/regex.rb
prospectus-0.0.5 lib/prospectus/helpers/regex.rb
prospectus-0.0.4 lib/prospectus/helpers/regex.rb
prospectus-0.0.3 lib/prospectus/helpers/regex.rb
prospectus-0.0.2 lib/prospectus/helpers/regex.rb