lib/rails_erd/relationship/cardinality.rb in rails-erd-0.1.1 vs lib/rails_erd/relationship/cardinality.rb in rails-erd-0.2.0
- old
+ new
@@ -1,24 +1,24 @@
module RailsERD
class Relationship
class Cardinality
- CARDINALITY_NAMES = %w{one_to_one one_to_many many_to_many} #:nodoc:
- ORDER = {} #:nodoc:
+ CARDINALITY_NAMES = %w{one_to_one one_to_many many_to_many} # @private :nodoc:
+ ORDER = {} # @private :nodoc:
class << self
- # Returns the cardinality as symbol.
+ # Returns the cardinality as a symbol.
attr_reader :type
-
- def from_macro(macro) #:nodoc:
+
+ def from_macro(macro) # @private :nodoc:
case macro
when :has_and_belongs_to_many then ManyToMany
when :has_many then OneToMany
when :has_one then OneToOne
end
end
- def <=>(other) #:nodoc:
+ def <=>(other) # @private :nodoc:
ORDER[self] <=> ORDER[other]
end
CARDINALITY_NAMES.each do |cardinality|
define_method :"#{cardinality}?" do
@@ -26,10 +26,10 @@
end
end
end
CARDINALITY_NAMES.each_with_index do |cardinality, i|
- klass = Cardinality.const_set cardinality.camelize.to_sym, Class.new(Cardinality) { @@type = cardinality }
+ klass = Cardinality.const_set cardinality.camelize.to_sym, Class.new(Cardinality) { @type = cardinality }
ORDER[klass] = i
end
end
end
end