Class: Mwc::CompileOptions
- Inherits:
-
Object
- Object
- Mwc::CompileOptions
- Defined in:
- lib/mwc/compile_options.rb
Overview
The compile options
Constant Summary collapse
- EXTRA_JS_TYPE =
:nodoc:
{ library_js: '--js-library', pre_js: '--pre-js', post_js: '--post-js' }.freeze
- OPTIONS =
%i[shell source_map extra].freeze
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ CompileOptions
constructor
:nodoc:.
-
#setup_extra ⇒ Object
private
Setup extra options.
-
#setup_shell ⇒ Object
private
Setup shell file.
-
#setup_source_map ⇒ Object
private
Setup source map.
-
#to_s ⇒ String
Convert options to string.
Constructor Details
#initialize(options = {}) ⇒ CompileOptions
:nodoc:
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mwc/compile_options.rb', line 18 def initialize( = {}) @options = [] .each do |name, value| handler = "add_#{name}" send(handler, value) if respond_to?(handler) end OPTIONS.each { |name| send("setup_#{name}") } output([:format]) end |
Instance Method Details
#setup_extra ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Setup extra options
54 55 56 57 58 59 60 |
# File 'lib/mwc/compile_options.rb', line 54 def setup_extra return unless Mwc.project..any? Mwc.project..each do |option| @options.push option end end |
#setup_shell ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Setup shell file
34 35 36 37 38 |
# File 'lib/mwc/compile_options.rb', line 34 def setup_shell return if Mwc.project.shell.nil? @options.push "--shell-file #{Mwc.project.shell}" end |
#setup_source_map ⇒ Object
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Setup source map
44 45 46 47 48 |
# File 'lib/mwc/compile_options.rb', line 44 def setup_source_map return unless Mwc.project.source_map @options.push '-g4 --source-map-base /' end |
#to_s ⇒ String
Convert options to string
65 66 67 |
# File 'lib/mwc/compile_options.rb', line 65 def to_s @options.join(' ') end |