Class: Bmg::Database::Xlsx
- Inherits:
-
Bmg::Database
- Object
- Bmg::Database
- Bmg::Database::Xlsx
- Defined in:
- lib/bmg/database/xlsx.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
{ }
Instance Method Summary collapse
- #each_relation_pair ⇒ Object
-
#initialize(path, options = {}) ⇒ Xlsx
constructor
A new instance of Xlsx.
- #method_missing(name, *args, &bl) ⇒ Object
Methods inherited from Bmg::Database
data_folder, sequel, #to_data_folder, #to_xlsx, xlsx
Constructor Details
#initialize(path, options = {}) ⇒ Xlsx
Returns a new instance of Xlsx.
8 9 10 11 12 |
# File 'lib/bmg/database/xlsx.rb', line 8 def initialize(path, = {}) path = Path(path) if path.is_a?(String) @path = path @options = .merge(DEFAULT_OPTIONS) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(name, *args, &bl) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/bmg/database/xlsx.rb', line 14 def method_missing(name, *args, &bl) return super(name, *args, &bl) unless args.empty? && bl.nil? rel = rel_for(name) raise NotSuchRelationError(name.to_s) unless rel rel end |
Instance Method Details
#each_relation_pair ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/bmg/database/xlsx.rb', line 21 def each_relation_pair return to_enum(:each_relation_pair) unless block_given? spreadsheet.sheets.each do |sheet_name| yield(sheet_name.to_sym, rel_for(sheet_name)) end end |