Sha256: e0f74717cb3393ea13965de0da6b0de443c8d60c067151f2ccfb52d9415b2efd

Contents?: true

Size: 1.11 KB

Versions: 6

Compression:

Stored size: 1.11 KB

Contents

module OrientDB
  class PropertyImpl

    def type_short
      @type_short ||= OrientDB::FIELD_TYPES.select { |k, v| v.name == getType.name }.first.first
    end

    def linked_type_short
      @linked_type_short ||= getLinkedType && OrientDB::FIELD_TYPES.select { |k, v| v.name == getLinkedType.name }.first.first
    end

    def info
      {
        :name         => name,
        :type         => type_short,
        :index        => indexed? ? getIndex.name : nil,
        :min          => min,
        :max          => max,
        :mandatory    => is_mandatory?,
        :not_null     => is_not_null?,
        :linked_type  => linked_type_short,
        :linked_class => linked_type_short ? getLinkedClass.name : nil,
      }
    end

    def inspect
      "#<OrientDB::Property:#{name} type=#{type_short} " +
        "#{linked_type_short ? "linked_type=#{linked_type_short} linked_class=#{getLinkedClass.name}" : ''}" +
        "indexed=#{is_indexed?} mandatory=#{is_mandatory?} not_null=#{is_not_null}" +
        "#{min ? " min=#{min}" : ''}#{max ? " max=#{max}" : ''}" +
        ">"
    end

    alias :to_s :inspect

  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
orientdb-1.7.8-java lib/orientdb/property.rb
orientdb-1.6.3-java lib/orientdb/property.rb
orientdb-1.5.0-java lib/orientdb/property.rb
orientdb-1.3.0-java lib/orientdb/property.rb
orientdb-1.2.0-java lib/orientdb/property.rb
orientdb-1.2.0 lib/orientdb/property.rb