Class: DataMapper::Reflection::Builders::Source::OneToMany

Inherits:
Relationship
  • Object
show all
Defined in:
lib/dm-reflection/builders/source_builder.rb

Direct Known Subclasses

ManyToMany

Instance Attribute Summary

Attributes inherited from Relationship

#backend

Instance Method Summary collapse

Methods inherited from Relationship

for, #irrelevant_options, #max, #min, #name, #option_priorities, #prioritized_options, #to_ruby

Methods included from OptionBuilder

#backend_options, #irrelevant_options, #option_priorities, #options, #prioritized_options, #rest_options

Instance Method Details

#cardinalityObject



302
303
304
305
306
307
308
309
310
311
312
# File 'lib/dm-reflection/builders/source_builder.rb', line 302

def cardinality
  max_string = max == Infinity ? 'n' : max.to_s

  if min == 0 || min == max
    max_string
  elsif max == Infinity
    "#{min}..#{max_string}"
  else
    super
  end
end

#typeObject



299
300
301
# File 'lib/dm-reflection/builders/source_builder.rb', line 299

def type
  :has
end