Class: Rack::CoreData::DataModel::Relationship
- Inherits:
-
Object
- Object
- Rack::CoreData::DataModel::Relationship
- Defined in:
- lib/rack/core-data/data_model/relationship.rb
Instance Attribute Summary collapse
-
#deletion_rule ⇒ Object
readonly
Returns the value of attribute deletion_rule.
-
#destination ⇒ Object
readonly
Returns the value of attribute destination.
-
#inverse ⇒ Object
readonly
Returns the value of attribute inverse.
-
#max_count ⇒ Object
readonly
Returns the value of attribute max_count.
-
#min_count ⇒ Object
readonly
Returns the value of attribute min_count.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
-
#initialize(relationship) ⇒ Relationship
constructor
A new instance of Relationship.
- #to_many? ⇒ Boolean
- #to_one? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(relationship) ⇒ Relationship
Returns a new instance of Relationship.
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 5 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 |
Instance Attribute Details
#deletion_rule ⇒ Object (readonly)
Returns the value of attribute deletion_rule.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def deletion_rule @deletion_rule end |
#destination ⇒ Object (readonly)
Returns the value of attribute destination.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def destination @destination end |
#inverse ⇒ Object (readonly)
Returns the value of attribute inverse.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def inverse @inverse end |
#max_count ⇒ Object (readonly)
Returns the value of attribute max_count.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def max_count @max_count end |
#min_count ⇒ Object (readonly)
Returns the value of attribute min_count.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def min_count @min_count end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 3 def name @name end |
Instance Method Details
#to_many? ⇒ Boolean
25 26 27 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 25 def to_many? !!@to_many end |
#to_one? ⇒ Boolean
29 30 31 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 29 def to_one? !to_many? end |
#to_s ⇒ Object
21 22 23 |
# File 'lib/rack/core-data/data_model/relationship.rb', line 21 def to_s @name end |