Class: BmmlExporters::BmmlExporter
- Inherits:
-
Object
- Object
- BmmlExporters::BmmlExporter
- Defined in:
- lib/bmmlexporter.rb
Instance Attribute Summary collapse
-
#opts ⇒ Object
Returns the value of attribute opts.
Instance Method Summary collapse
- #check_response_and_call(obj, method_symbol, *args) ⇒ Object
- #export ⇒ Object
- #export! ⇒ Object
-
#initialize(*opts) ⇒ BmmlExporter
constructor
A new instance of BmmlExporter.
- #save ⇒ Object
- #set_options(*opts) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*opts) ⇒ BmmlExporter
13 14 15 |
# File 'lib/bmmlexporter.rb', line 13 def initialize(*opts) (*opts) end |
Instance Attribute Details
#opts ⇒ Object
Returns the value of attribute opts.
12 13 14 |
# File 'lib/bmmlexporter.rb', line 12 def opts @opts end |
Instance Method Details
#check_response_and_call(obj, method_symbol, *args) ⇒ Object
51 52 53 54 |
# File 'lib/bmmlexporter.rb', line 51 def check_response_and_call(obj, method_symbol, *args) raise 'The exporter '+obj.class.to_s+' does not respond to the method '+method_symbol.to_s unless obj and obj.respond_to?(method_symbol) obj.send(method_symbol, *args) end |
#export ⇒ Object
38 39 40 |
# File 'lib/bmmlexporter.rb', line 38 def export check_response_and_call(@exporter, :export) end |
#export! ⇒ Object
46 47 48 49 |
# File 'lib/bmmlexporter.rb', line 46 def export! export save end |
#save ⇒ Object
42 43 44 |
# File 'lib/bmmlexporter.rb', line 42 def save check_response_and_call(@exporter, :save) end |
#set_options(*opts) ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/bmmlexporter.rb', line 21 def (*opts) = *opts raise "Require :import parameter" if [:import].to_s.nil? raise "Require :export_type parameter" if [:export_type].to_s.nil? if [:import].eql? "file" raise "Require :file if :import => 'file'" if [:file].nil? end raise "Require a valid :export_type: html / flex, mentioned " + [:export_type] unless [:export_type].eql? 'html' or [:export_type].eql? 'flex' # Reminder: :import (file,inline), :file(name.bmml), :export_type (html/flex), :export_folder('./output') @exporter = [:exporter] check_response_and_call(@exporter, :set_options, ) end |
#to_s ⇒ Object
17 18 19 |
# File 'lib/bmmlexporter.rb', line 17 def to_s check_response_and_call(@exporter, :to_s) end |