Class: Scenic::Cascade::Dependency
- Inherits:
-
Object
- Object
- Scenic::Cascade::Dependency
- Defined in:
- lib/scenic/cascade/dependency.rb
Overview
Represents a view dependency
Instance Attribute Summary collapse
-
#from ⇒ Object
readonly
Returns the value of attribute from.
-
#to ⇒ Object
readonly
Returns the value of attribute to.
Class Method Summary collapse
Instance Method Summary collapse
- #==(other) ⇒ Object
-
#initialize(from:, to:) ⇒ Dependency
constructor
A new instance of Dependency.
-
#to_s ⇒ Object
(also: #inspect)
mermaid-like syntax.
Constructor Details
#initialize(from:, to:) ⇒ Dependency
Returns a new instance of Dependency.
11 12 13 14 15 16 17 |
# File 'lib/scenic/cascade/dependency.rb', line 11 def initialize(from:, to:) raise TypeError unless from.is_a?(Scenic::Cascade::View) raise TypeError unless to.is_a?(Scenic::Cascade::View) @from = from @to = to end |
Instance Attribute Details
#from ⇒ Object (readonly)
Returns the value of attribute from.
9 10 11 |
# File 'lib/scenic/cascade/dependency.rb', line 9 def from @from end |
#to ⇒ Object (readonly)
Returns the value of attribute to.
9 10 11 |
# File 'lib/scenic/cascade/dependency.rb', line 9 def to @to end |
Class Method Details
.from_hash(hash) ⇒ Object
30 31 32 33 34 |
# File 'lib/scenic/cascade/dependency.rb', line 30 def self.from_hash(hash) from = Scenic::Cascade::View.new(name: hash['from'], materialized: hash['from_materialized']) to = Scenic::Cascade::View.new(name: hash['to'], materialized: hash['to_materialized']) new(from: from, to: to) end |
Instance Method Details
#==(other) ⇒ Object
19 20 21 |
# File 'lib/scenic/cascade/dependency.rb', line 19 def ==(other) from == other.from && to == other.to end |
#to_s ⇒ Object Also known as: inspect
mermaid-like syntax
24 25 26 |
# File 'lib/scenic/cascade/dependency.rb', line 24 def to_s "#{from.name}[#{from}] --> #{to.name}[#{to}]" end |