Class: SqlView::Model

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

Class Method Summary collapse

Class Method Details

.extend_model_with(&block) ⇒ Object



54
55
56
# File 'lib/sql_view.rb', line 54

def self.extend_model_with(&block)
  self.sql_view_options[:extend_model_with] = block
end

.inherited(subclass) ⇒ Object



26
27
28
# File 'lib/sql_view.rb', line 26

def self.inherited(subclass)
  subclass.sql_view_options = {}
end

.materializedObject



46
47
48
# File 'lib/sql_view.rb', line 46

def self.materialized
  self.sql_view_options[:materialized] = true
end

.modelObject



38
39
40
# File 'lib/sql_view.rb', line 38

def self.model
  @model ||= ClassBuilder.create_model(self)
end

.schema(sql_or_proc) ⇒ Object



50
51
52
# File 'lib/sql_view.rb', line 50

def self.schema(sql_or_proc)
  self.sql_view_options[:sql_or_proc] = sql_or_proc
end

.sql_viewObject



42
43
44
# File 'lib/sql_view.rb', line 42

def self.sql_view
  @sql_view ||= Migration.new(self)
end

.view_nameObject



34
35
36
# File 'lib/sql_view.rb', line 34

def self.view_name
  @view_name.presence || (self.view_name=self.to_s.underscore.pluralize)
end

.view_name=(name) ⇒ Object



30
31
32
# File 'lib/sql_view.rb', line 30

def self.view_name=(name)
  @view_name = name
end