Sha256: b78e7f16080b09a71f071315b2330341f6feb10af72de733c2d75c4191666c28

Contents?: true

Size: 623 Bytes

Versions: 87

Compression:

Stored size: 623 Bytes

Contents

module Acfs::Model::Attributes

  # @api public
  #
  # List attribute type. Use it in your model as an attribute type:
  #
  # @example
  #   class User
  #     include Acfs::Model
  #     attribute :name, :list
  #   end
  #
  class List < Base

    # @api public
    #
    # Cast given object to a list.
    #
    # @param [Object] obj Object to cast.
    # @return [Fixnum] Casted object as list.
    # @raise [TypeError] If object cannot be casted to a list.
    #
    def cast_type(obj)
      return obj.to_a if obj.respond_to? :to_a
      raise TypeError.new "Cannot cast #{obj.inspect} to array."
    end
  end
end

Version data entries

87 entries across 87 versions & 1 rubygems

Version Path
acfs-0.25.0.1.b227 lib/acfs/model/attributes/list.rb
acfs-0.25.0.1.b226 lib/acfs/model/attributes/list.rb
acfs-0.25.0.1.b225 lib/acfs/model/attributes/list.rb
acfs-0.25.0.1.b223 lib/acfs/model/attributes/list.rb
acfs-0.25.0.1.b221 lib/acfs/model/attributes/list.rb
acfs-0.25.0.1.b217 lib/acfs/model/attributes/list.rb
acfs-0.25.0 lib/acfs/model/attributes/list.rb
acfs-0.24.0.1.b216 lib/acfs/model/attributes/list.rb
acfs-0.24.0.1.b214 lib/acfs/model/attributes/list.rb
acfs-0.24.0.1.b212 lib/acfs/model/attributes/list.rb
acfs-0.24.0.b210 lib/acfs/model/attributes/list.rb
acfs-0.24.0 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b209 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b208 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b206 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b205 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b204 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b203 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b200 lib/acfs/model/attributes/list.rb
acfs-0.23.2.b199 lib/acfs/model/attributes/list.rb