Class: Para::Exporter::Base
- Inherits:
-
Object
- Object
- Para::Exporter::Base
- Defined in:
- lib/para/exporter/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#resources ⇒ Object
readonly
Returns the value of attribute resources.
Class Method Summary collapse
Instance Method Summary collapse
- #disposition ⇒ Object
- #extension ⇒ Object
- #file_name ⇒ Object
-
#initialize(resources) ⇒ Base
constructor
A new instance of Base.
- #model ⇒ Object
Constructor Details
#initialize(resources) ⇒ Base
Returns a new instance of Base.
7 8 9 |
# File 'lib/para/exporter/base.rb', line 7 def initialize(resources) @resources = resources end |
Instance Attribute Details
#resources ⇒ Object (readonly)
Returns the value of attribute resources.
4 5 6 |
# File 'lib/para/exporter/base.rb', line 4 def resources @resources end |
Class Method Details
.exports(model_name) ⇒ Object
19 20 21 |
# File 'lib/para/exporter/base.rb', line 19 def self.exports model_name self.model_name = model_name end |
.register_base_exporter(type, exporter) ⇒ Object
35 36 37 |
# File 'lib/para/exporter/base.rb', line 35 def self.register_base_exporter(type, exporter) Exporter.base_exporters[type] = exporter end |
Instance Method Details
#disposition ⇒ Object
23 24 25 |
# File 'lib/para/exporter/base.rb', line 23 def disposition 'inline' end |
#extension ⇒ Object
27 28 29 |
# File 'lib/para/exporter/base.rb', line 27 def extension raise '#extension must be defined to create the export file name' end |
#file_name ⇒ Object
31 32 33 |
# File 'lib/para/exporter/base.rb', line 31 def file_name @file_name ||= [name, extension].join('.') end |
#model ⇒ Object
11 12 13 14 15 16 17 |
# File 'lib/para/exporter/base.rb', line 11 def model @model ||= if (model_name = self.class.model_name) model_name.constantize else raise 'You must define model to export in your exporter as following: `exports \'YourModelName\'`' end end |