Class: CoreData::DataModel::Entity
- Inherits:
-
Object
- Object
- CoreData::DataModel::Entity
- Defined in:
- lib/core_data/data_model/entity.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#relationships ⇒ Object
readonly
Returns the value of attribute relationships.
Instance Method Summary collapse
-
#initialize(entity) ⇒ Entity
constructor
A new instance of Entity.
- #to_s ⇒ Object
Constructor Details
#initialize(entity) ⇒ Entity
Returns a new instance of Entity.
6 7 8 9 10 11 12 |
# File 'lib/core_data/data_model/entity.rb', line 6 def initialize(entity) raise ArgumentError unless ::Nokogiri::XML::Element === entity @name = entity['name'] @attributes = entity.xpath('attribute').collect{|element| Attribute.new(element)} @relationships = entity.xpath('relationship').collect{|element| Relationship.new(element)} end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
4 5 6 |
# File 'lib/core_data/data_model/entity.rb', line 4 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/core_data/data_model/entity.rb', line 4 def name @name end |
#relationships ⇒ Object (readonly)
Returns the value of attribute relationships.
4 5 6 |
# File 'lib/core_data/data_model/entity.rb', line 4 def relationships @relationships end |
Instance Method Details
#to_s ⇒ Object
14 15 16 |
# File 'lib/core_data/data_model/entity.rb', line 14 def to_s @name end |