Class: Viewmatic::View

Inherits:
Object
  • Object
show all
Defined in:
lib/viewmatic/view.rb

Overview

Represents a view to be built.

Instance Method Summary collapse

Constructor Details

#initialize(name, materialized: false) ⇒ View

Initialize a new view.

Parameters:

  • name (Symbol)

    name of the view as it will appear in the database

  • materialized (Boolean) (defaults to: false)

    true if this is to be a materialized view



12
13
14
15
# File 'lib/viewmatic/view.rb', line 12

def initialize(name, materialized: false)
  @name = name
  @materialized = materialized
end

Instance Method Details

#column_names(val = nil) ⇒ Object

Get/set the query column name overrides



30
31
32
33
# File 'lib/viewmatic/view.rb', line 30

def column_names(val = nil)
  @column_names = val unless val.nil?
  @column_names
end

#materialized(val = nil) ⇒ Object

Get/set the materialized status



36
37
38
39
# File 'lib/viewmatic/view.rb', line 36

def materialized(val = nil)
  @materialized = val unless val.nil?
  @materialized
end

#name(val = nil) ⇒ Object

Get/set the view name



18
19
20
21
# File 'lib/viewmatic/view.rb', line 18

def name(val = nil)
  @name = val unless val.nil?
  @name
end

#query(val = nil) ⇒ Object

Get/set the query backing the view



24
25
26
27
# File 'lib/viewmatic/view.rb', line 24

def query(val = nil)
  @query = val unless val.nil?
  @query
end