Class: Dag::Standard::EndPoint
- Inherits:
-
Object
- Object
- Dag::Standard::EndPoint
- Defined in:
- lib/dag/standard.rb
Overview
Encapsulates the necessary information about a graph node
Instance Attribute Summary collapse
-
#id ⇒ Object
readonly
Returns the value of attribute id.
Class Method Summary collapse
-
.from(obj) ⇒ Object
Factory Construction method that creates an endpoint from a model if necessary.
-
.from_resource(resource) ⇒ Object
Factory Construction method that creates an endpoint from a model.
Instance Method Summary collapse
-
#initialize(id) ⇒ EndPoint
constructor
Initializes an endpoint based on an Id.
-
#matches?(other) ⇒ Boolean
Does an endpoint match another endpoint or model instance.
Constructor Details
#initialize(id) ⇒ EndPoint
Initializes an endpoint based on an Id
27 28 29 |
# File 'lib/dag/standard.rb', line 27 def initialize(id) @id = id end |
Instance Attribute Details
#id ⇒ Object (readonly)
Returns the value of attribute id.
31 32 33 |
# File 'lib/dag/standard.rb', line 31 def id @id end |
Class Method Details
.from(obj) ⇒ Object
Factory Construction method that creates an endpoint from a model if necessary
21 22 23 24 |
# File 'lib/dag/standard.rb', line 21 def self.from(obj) return obj if obj.kind_of?(EndPoint) self.from_resource(obj) end |
.from_resource(resource) ⇒ Object
Factory Construction method that creates an endpoint from a model
16 17 18 |
# File 'lib/dag/standard.rb', line 16 def self.from_resource(resource) self.new(resource.id) end |
Instance Method Details
#matches?(other) ⇒ Boolean
Does an endpoint match another endpoint or model instance
11 12 13 |
# File 'lib/dag/standard.rb', line 11 def matches?(other) self.id == other.id end |