Class: Scenic::Cascade::ViewWithVersion

Inherits:
View
  • Object
show all
Defined in:
lib/scenic/cascade/view_with_version.rb

Overview

Represents a view with version

Instance Attribute Summary collapse

Attributes inherited from View

#name

Instance Method Summary collapse

Methods inherited from View

#formatted_name, #materialized?

Constructor Details

#initialize(name:, version:, materialized:) ⇒ ViewWithVersion

Returns a new instance of ViewWithVersion.

Raises:

  • (TypeError)


9
10
11
12
13
14
15
# File 'lib/scenic/cascade/view_with_version.rb', line 9

def initialize(name:, version:, materialized:)
  super(name: name, materialized: materialized)

  raise TypeError unless version.is_a?(Integer)

  @version = version
end

Instance Attribute Details

#versionObject (readonly)

Returns the value of attribute version.



7
8
9
# File 'lib/scenic/cascade/view_with_version.rb', line 7

def version
  @version
end

Instance Method Details

#==(other) ⇒ Object



17
18
19
# File 'lib/scenic/cascade/view_with_version.rb', line 17

def ==(other)
  name == other.name && version == other.version && materialized? == other.materialized?
end

#to_sObject Also known as: inspect



21
22
23
# File 'lib/scenic/cascade/view_with_version.rb', line 21

def to_s
  "#{name}_v#{formatted_version} (#{materialized? ? 'MV' : 'V'})"
end