Class: Bmg::Database::Sequel
- Inherits:
-
Bmg::Database
- Object
- Bmg::Database
- Bmg::Database::Sequel
- Defined in:
- lib/bmg/database/sequel.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ }
Instance Method Summary collapse
- #each_relation_pair ⇒ Object
-
#initialize(sequel_db, options = {}) ⇒ Sequel
constructor
A new instance of Sequel.
- #method_missing(name, *args, &bl) ⇒ Object
Methods inherited from Bmg::Database
data_folder, sequel, #to_data_folder, #to_xlsx, xlsx
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &bl) ⇒ Object
13 14 15 16 17 |
# File 'lib/bmg/database/sequel.rb', line 13 def method_missing(name, *args, &bl) return super(name, *args, &bl) unless args.empty? && bl.nil? raise NotSuchRelationError(name.to_s) unless @sequel_db.table_exists?(name) rel_for(name) end |
Instance Method Details
#each_relation_pair ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/bmg/database/sequel.rb', line 19 def each_relation_pair return to_enum(:each_relation_pair) unless block_given? @sequel_db.tables.each do |table| yield(table, rel_for(table)) end end |