Sha256: be2fad171d5079046d625e586ef37269e1cbd9e378a67cc2f71c25b6d42eb708

Contents?: true

Size: 890 Bytes

Versions: 18

Compression:

Stored size: 890 Bytes

Contents

module GroupDocs
  class DataSource::Field < GroupDocs::Api::Entity

    TYPES = {
      text:   0,
      binary: 1,
    }

    # @attr [String] field
    attr_accessor :field
    # @attr [Integer] type
    attr_accessor :type
    # @attr [Array<String>] values
    attr_accessor :values

    # Compatibility with response JSON
    alias_method :name=, :field=

    #
    # Updates type with machine-readable format.
    #
    # @param [Symbol] type
    # @raise [ArgumentError] if type is unknown
    #
    def type=(type)
      if type.is_a?(Symbol)
        TYPES.keys.include?(type) or raise ArgumentError, "Unknown type: #{type.inspect}"
        type = TYPES[type]
      end

      @type = type
    end

    #
    # Returns field type in human-readable format.
    #
    # @return [Symbol]
    #
    def type
      TYPES.invert[@type]
    end

  end # DataSource::Field
end # GroupDocs

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
groupdocs-0.3.7 lib/groupdocs/datasource/field.rb
groupdocs-0.3.6 lib/groupdocs/datasource/field.rb
groupdocs-0.3.5 lib/groupdocs/datasource/field.rb
groupdocs-0.3.0 lib/groupdocs/datasource/field.rb
groupdocs-0.2.11 lib/groupdocs/datasource/field.rb
groupdocs-0.2.10 lib/groupdocs/datasource/field.rb
groupdocs-0.2.9 lib/groupdocs/datasource/field.rb
groupdocs-0.2.8 lib/groupdocs/datasource/field.rb
groupdocs-0.2.7 lib/groupdocs/datasource/field.rb
groupdocs-0.2.6 lib/groupdocs/datasource/field.rb
groupdocs-0.2.5 lib/groupdocs/datasource/field.rb
groupdocs-0.2.4 lib/groupdocs/datasource/field.rb
groupdocs-0.2.3 lib/groupdocs/datasource/field.rb
groupdocs-0.2.2 lib/groupdocs/datasource/field.rb
groupdocs-0.2.1 lib/groupdocs/datasource/field.rb
groupdocs-0.2 lib/groupdocs/datasource/field.rb
groupdocs-0.1.1 lib/groupdocs/datasource/field.rb
groupdocs-0.1.0 lib/groupdocs/datasource/field.rb