Sha256: b312dbec5cbb65bef7b689874f4819b642deb71ffd86f4cbd2751c375e214f82

Contents?: true

Size: 494 Bytes

Versions: 1

Compression:

Stored size: 494 Bytes

Contents

module DataMapper
  module Support
    module String
      
      def ensure_starts_with(part)
        [0,1] == part ? self : (part + self)
      end
  
      def ensure_ends_with(part)
        [-1,1] == part ? self : (self + part)
      end
  
      def ensure_wrapped_with(a, b = nil)
        ensure_starts_with(a).ensure_ends_with(b || a)
      end
      
    end # module String
  end # module Support
end # module DataMapper

class String #:nodoc:
  include DataMapper::Support::String
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
datamapper-0.1.0 lib/data_mapper/support/string.rb