Class: BomDB::Export::Base
- Inherits:
-
Object
- Object
- BomDB::Export::Base
- Defined in:
- lib/bomdb/export/base.rb
Instance Attribute Summary collapse
-
#db ⇒ Object
readonly
Returns the value of attribute db.
-
#opts ⇒ Object
readonly
Returns the value of attribute opts.
Instance Method Summary collapse
- #export(format: 'json', **options) ⇒ Object
-
#initialize(db, **opts) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(db, **opts) ⇒ Base
Returns a new instance of Base.
6 7 8 9 |
# File 'lib/bomdb/export/base.rb', line 6 def initialize(db, **opts) @db = db @opts = opts end |
Instance Attribute Details
#db ⇒ Object (readonly)
Returns the value of attribute db.
4 5 6 |
# File 'lib/bomdb/export/base.rb', line 4 def db @db end |
#opts ⇒ Object (readonly)
Returns the value of attribute opts.
4 5 6 |
# File 'lib/bomdb/export/base.rb', line 4 def opts @opts end |
Instance Method Details
#export(format: 'json', **options) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/bomdb/export/base.rb', line 11 def export(format: 'json', **) case format when 'json' then export_json when 'text' then export_text else return Import::Result.new( success: false, error: "Unknown format: #{format}" ) end end |