Sha256: adbbe1ebdd8a3c3254bd02298409e6eac8c1a861a4557cebcebc569416b714c8
Contents?: true
Size: 977 Bytes
Versions: 7
Compression:
Stored size: 977 Bytes
Contents
class Rack::CoreData::DataModel class Relationship attr_reader :name, :destination, :inverse, :deletion_rule, :min_count, :max_count def initialize(relationship) raise ArgumentError unless ::Nokogiri::XML::Element === relationship @name = relationship['name'] @destination = relationship['destinationEntity'] @inverse = relationship['inverseName'] @deletion_rule = relationship['deletionRule'].downcase.to_sym @min_count = relationship['minCount'].to_i @max_count = relationship['maxCount'].to_i @to_many = relationship['toMany'] == "YES" @optional = relationship['optional'] == "YES" @syncable = relationship['syncable'] == "YES" end def to_s @name end def to_many? !!@to_many end def to_one? !to_many? end [:optional, :syncable].each do |symbol| define_method("#{symbol}?") {!!instance_variable_get(("@#{symbol}").intern)} end end end
Version data entries
7 entries across 7 versions & 1 rubygems