Sha256: 4392946682bf6f94f16b20334d9a0a773de06acbb8f8ebc9e9a9132b0d105f5b

Contents?: true

Size: 687 Bytes

Versions: 4

Compression:

Stored size: 687 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 }

      FromObject = -> data { String(data) }

      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 = {
      Downcase: :LowerCase,
      FromObject: :String,
      GSub: :ReplaceAll,
      Strip: :Trim,
    }.freeze
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
ruby-lambdas-0.4.1 lib/ruby/lambdas/strings/to_export.rb
ruby-lambdas-0.4.0 lib/ruby/lambdas/strings/to_export.rb
ruby-lambdas-0.3.0 lib/ruby/lambdas/strings/to_export.rb
ruby-lambdas-0.2.0 lib/ruby/lambdas/strings/to_export.rb