Class: Rack::CoreData::DataModel::Entity
- Inherits:
-
Object
- Object
- Rack::CoreData::DataModel::Entity
- Defined in:
- lib/rack/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.
5 6 7 8 9 10 11 |
# File 'lib/rack/core-data/data_model/entity.rb', line 5 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.
3 4 5 |
# File 'lib/rack/core-data/data_model/entity.rb', line 3 def attributes @attributes end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/rack/core-data/data_model/entity.rb', line 3 def name @name end |
#relationships ⇒ Object (readonly)
Returns the value of attribute relationships.
3 4 5 |
# File 'lib/rack/core-data/data_model/entity.rb', line 3 def relationships @relationships end |
Instance Method Details
#to_s ⇒ Object
13 14 15 |
# File 'lib/rack/core-data/data_model/entity.rb', line 13 def to_s @name end |