Class: Sequel::ReadyMaker::FileSourcerer
- Inherits:
-
Object
- Object
- Sequel::ReadyMaker::FileSourcerer
- Defined in:
- lib/sequel/extensions/make_readyable.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#schema ⇒ Object
readonly
Returns the value of attribute schema.
Instance Method Summary collapse
- #create_view(table, opts = {}) ⇒ Object
- #format ⇒ Object
-
#initialize(db, schema) ⇒ FileSourcerer
constructor
A new instance of FileSourcerer.
- #tables(opts = {}) ⇒ Object
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
#db ⇒ Object (readonly)
Returns the value of attribute db.
83 84 85 |
# File 'lib/sequel/extensions/make_readyable.rb', line 83 def db @db end |
#schema ⇒ Object (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. } }.merge(opts)) end |
#format ⇒ Object
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 |