Sha256: 257d01445428afe1f4f73f82c3ec1604ab6ca37c835ed1cb860d33ee3d30ad7e

Contents?: true

Size: 1.11 KB

Versions: 7

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::Propery:#{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

7 entries across 7 versions & 1 rubygems

Version Path
orientdb-0.0.25-jruby lib/orientdb/property.rb
orientdb-0.0.24-jruby lib/orientdb/property.rb
orientdb-0.0.23-jruby lib/orientdb/property.rb
orientdb-0.0.22-jruby lib/orientdb/property.rb
orientdb-0.0.21-jruby lib/orientdb/property.rb
orientdb-0.0.20-jruby lib/orientdb/property.rb
orientdb-0.0.19-jruby lib/orientdb/property.rb