Sha256: 0e4e90484816291461b2e03eea9c8e7cca52831741a954399b2793293a814532

Contents?: true

Size: 659 Bytes

Versions: 13

Compression:

Stored size: 659 Bytes

Contents

# encoding: utf-8
module Mongoid #:nodoc:
  module Extensions #:nodoc:
    module String #:nodoc:
      module Conversions #:nodoc:
        extend ActiveSupport::Concern

        # Convert the string to an array with the string in it.
        #
        # Example:
        #
        # <tt>"Testing".to_a</tt>
        #
        # Returns:
        #
        # An array with only the string in it.
        def to_a
          [ self ]
        end

        module ClassMethods #:nodoc:

          def get(value)
            value
          end

          def set(value)
            value.to_s unless value.nil?
          end
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 3 rubygems

Version Path
mongoid-braxton-2.0.2 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.2 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.1 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.8 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.7 lib/mongoid/extensions/string/conversions.rb
stonegao-mongoid-2.0.0.rc.6 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.6 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.5 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.4 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.3 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.2 lib/mongoid/extensions/string/conversions.rb
mongoid-2.0.0.rc.1 lib/mongoid/extensions/string/conversions.rb