Sha256: a51edc174a89bc1511a699a2b19f8832aca7a55d9e4889cd989b4a50b31830eb

Contents?: true

Size: 615 Bytes

Versions: 1

Compression:

Stored size: 615 Bytes

Contents

module RubyLambdas
  module Strings
    module ToExport
      Capitalize = -> data { data.capitalize }

      Center = -> (width, data) { data.center(width) }

      CenterWith = -> (width, padstr, data) { data.center(width, padstr) }

      Downcase = -> data { data.downcase }

      GSub = -> (pattern, replacement, data) do
        return data.gsub(pattern, &replacement) if replacement.is_a?(::Proc)

        data.gsub(pattern, replacement)
      end

      Strip = -> data { data.strip }
    end

    ALIASES = {
      GSub: :ReplaceAll,
      Downcase: :LowerCase,
      Strip: :Trim,
    }.freeze
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
ruby-lambdas-0.1.0 lib/ruby/lambdas/strings/to_export.rb