Sha256: 7c1cd0457e35900bd9d23f055efd3e45bfa76076282744a514bd47f8065170d3

Contents?: true

Size: 1.11 KB

Versions: 12

Compression:

Stored size: 1.11 KB

Contents

module OrientDB

  class Property

    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

12 entries across 12 versions & 1 rubygems

Version Path
orientdb-0.0.17-jruby lib/orientdb/property.rb
orientdb-0.0.16-jruby lib/orientdb/property.rb
orientdb-0.0.15-jruby lib/orientdb/property.rb
orientdb-0.0.14-jruby lib/orientdb/property.rb
orientdb-0.0.12-jruby lib/orientdb/property.rb
orientdb-0.0.11-jruby lib/orientdb/property.rb
orientdb-0.0.10-jruby lib/orientdb/property.rb
orientdb-0.0.9-jruby lib/orientdb/property.rb
orientdb-0.0.8-jruby lib/orientdb/property.rb
orientdb-0.0.7-jruby lib/orientdb/property.rb
orientdb-0.0.6-jruby lib/orientdb/property.rb
orientdb-0.0.5-jruby lib/orientdb/property.rb