Class: Sequel::ReadyMaker::FileSourcerer

Inherits:
Object
  • Object
show all
Defined in:
lib/sequel/extensions/make_readyable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(db, schema) ⇒ FileSourcerer



84
85
86
87
# File 'lib/sequel/extensions/make_readyable.rb', line 84

def initialize(db, schema)
  @db = db
  @schema = schema
end

Instance Attribute Details

#dbObject (readonly)

Returns the value of attribute db.



83
84
85
# File 'lib/sequel/extensions/make_readyable.rb', line 83

def db
  @db
end

#schemaObject (readonly)

Returns the value of attribute schema.



83
84
85
# File 'lib/sequel/extensions/make_readyable.rb', line 83

def schema
  @schema
end

Instance Method Details

#create_view(table, opts = {}) ⇒ Object



93
94
95
96
97
98
99
# File 'lib/sequel/extensions/make_readyable.rb', line 93

def create_view(table, opts = {})
  db.create_view(table, {
    temp: true,
    using: format,
    options: { path: schema.expand_path }
  }.merge(opts))
end

#formatObject



101
102
103
# File 'lib/sequel/extensions/make_readyable.rb', line 101

def format
  schema.extname[1..-1]
end

#tables(opts = {}) ⇒ Object



89
90
91
# File 'lib/sequel/extensions/make_readyable.rb', line 89

def tables(opts = {})
  [schema.basename(".*").to_s.to_sym]
end