Class: Sbom::Data::Relationship
- Inherits:
-
Object
- Object
- Sbom::Data::Relationship
- Defined in:
- lib/sbom/data/relationship.rb
Instance Attribute Summary collapse
-
#relationship_type ⇒ Object
Returns the value of attribute relationship_type.
-
#source ⇒ Object
Returns the value of attribute source.
-
#source_id ⇒ Object
Returns the value of attribute source_id.
-
#source_type ⇒ Object
Returns the value of attribute source_type.
-
#target ⇒ Object
Returns the value of attribute target.
-
#target_id ⇒ Object
Returns the value of attribute target_id.
-
#target_type ⇒ Object
Returns the value of attribute target_type.
Instance Method Summary collapse
-
#initialize(source: nil, target: nil, relationship_type: nil) ⇒ Relationship
constructor
A new instance of Relationship.
- #reset! ⇒ Object
- #to_h ⇒ Object
Constructor Details
#initialize(source: nil, target: nil, relationship_type: nil) ⇒ Relationship
Returns a new instance of Relationship.
10 11 12 13 14 15 16 17 18 |
# File 'lib/sbom/data/relationship.rb', line 10 def initialize(source: nil, target: nil, relationship_type: nil) @source = source @target = target @relationship_type = relationship_type&.strip @source_id = nil @target_id = nil @source_type = nil @target_type = nil end |
Instance Attribute Details
#relationship_type ⇒ Object
Returns the value of attribute relationship_type.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def relationship_type @relationship_type end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def source @source end |
#source_id ⇒ Object
Returns the value of attribute source_id.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def source_id @source_id end |
#source_type ⇒ Object
Returns the value of attribute source_type.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def source_type @source_type end |
#target ⇒ Object
Returns the value of attribute target.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def target @target end |
#target_id ⇒ Object
Returns the value of attribute target_id.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def target_id @target_id end |
#target_type ⇒ Object
Returns the value of attribute target_type.
6 7 8 |
# File 'lib/sbom/data/relationship.rb', line 6 def target_type @target_type end |
Instance Method Details
#reset! ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/sbom/data/relationship.rb', line 20 def reset! @source = nil @target = nil @relationship_type = nil @source_id = nil @target_id = nil @source_type = nil @target_type = nil end |
#to_h ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/sbom/data/relationship.rb', line 30 def to_h { source: @source, target: @target, type: @relationship_type, source_id: @source_id, target_id: @target_id, source_type: @source_type, target_type: @target_type }.compact end |