Class: Scenic::Cascade::View
- Inherits:
-
Object
- Object
- Scenic::Cascade::View
- Defined in:
- lib/scenic/cascade/view.rb
Overview
Represents a view
Direct Known Subclasses
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #formatted_name ⇒ Object
-
#initialize(name:, materialized:) ⇒ View
constructor
A new instance of View.
- #materialized? ⇒ Boolean
- #to_s ⇒ Object (also: #inspect)
Constructor Details
#initialize(name:, materialized:) ⇒ View
Returns a new instance of View.
9 10 11 12 13 14 15 |
# File 'lib/scenic/cascade/view.rb', line 9 def initialize(name:, materialized:) raise TypeError unless name.is_a?(String) raise TypeError unless materialized.is_a?(TrueClass) || materialized.is_a?(FalseClass) @name = name @materialized = materialized end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
7 8 9 |
# File 'lib/scenic/cascade/view.rb', line 7 def name @name end |
Instance Method Details
#==(other) ⇒ Object
25 26 27 |
# File 'lib/scenic/cascade/view.rb', line 25 def ==(other) name == other.name && materialized? == other.materialized? end |
#formatted_name ⇒ Object
21 22 23 |
# File 'lib/scenic/cascade/view.rb', line 21 def formatted_name name.include?('.') ? %("#{name}") : ":#{name}" end |
#materialized? ⇒ Boolean
17 18 19 |
# File 'lib/scenic/cascade/view.rb', line 17 def materialized? @materialized end |
#to_s ⇒ Object Also known as: inspect
29 30 31 |
# File 'lib/scenic/cascade/view.rb', line 29 def to_s "#{name} (#{materialized? ? 'MV' : 'V'})" end |