Sha256: c048cee9a7f5f316e7a22a021f9e1c6af4ff84481cc56cf19dc3f1905a46afa8
Contents?: true
Size: 1.71 KB
Versions: 1
Compression:
Stored size: 1.71 KB
Contents
module Pacer::Orient class Property extend Forwardable attr_reader :el_type, :property def_delegators :@property, :name, :full_name, :not_null?, :collate, :mandatory?, :readonly?, :min, :max, :index, :indexed?, :regexp, :type, :custom, :custom_keys def initialize(el_type, property) @el_type = el_type @property = property end def graph el_type.graph end def create_index!(index_type = :not_unique) unless indexed? graph.send(:in_pure_transaction) do property.createIndex graph.index_type(index_type) end end self end def drop_index! graph.drop_key_index name if indexed? self end def set_type!(t) # Not implemented as of 1.7.8 fail Pacer::InternalError.new("Type migration is a planned Orient 2.x feature") end def drop! el_type.drop_property! name nil end def range_index? if i = index t = Graph::ITYPE_REVERSE[i.getType] t[:range] if t end end def unique_index? if i = index t = Graph::ITYPE_REVERSE[i.getType] t[:unique] if t end end def index_type if i = index t = Graph::ITYPE_REVERSE[i.getType] t[:type] if t end end [ :set_name, :set_not_null, :set_collate, :set_mandatory, :set_readonly, :set_min, :set_max, :set_regexp, :set_custom, :remove_custom, :clear_custom ].each do |setter| define_method(setter) do |*args| property.send setter, *args self end end def inspect "#<#{ el_type.type_name.capitalize }Property #{ el_type.name }.#{ property.name } (#{ type })>" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
pacer-orient-2.1.2-java | lib/pacer-orient/property.rb |