Class: Sprockets::BumbleD::Config
- Inherits:
-
Object
- Object
- Sprockets::BumbleD::Config
- Defined in:
- lib/sprockets/bumble_d/config.rb
Instance Attribute Summary collapse
-
#babel_config_version ⇒ Object
Returns the value of attribute babel_config_version.
-
#babel_options ⇒ Object
Returns the value of attribute babel_options.
-
#file_extension ⇒ Object
Returns the value of attribute file_extension.
-
#globals_map ⇒ Object
readonly
Returns the value of attribute globals_map.
-
#root_dir ⇒ Object
Returns the value of attribute root_dir.
-
#transform_to_umd ⇒ Object
Returns the value of attribute transform_to_umd.
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
-
#initialize ⇒ Config
constructor
A new instance of Config.
- #register_globals(globals_map) ⇒ Object
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
13 14 15 16 17 18 19 20 21 |
# File 'lib/sprockets/bumble_d/config.rb', line 13 def initialize @file_extension = '.es6' @globals_map = {}.freeze @transform_to_umd = true @babel_options = { presets: ['@babel/preset-env'], plugins: ['@babel/plugin-external-helpers'] } end |
Instance Attribute Details
#babel_config_version ⇒ Object
Returns the value of attribute babel_config_version.
6 7 8 |
# File 'lib/sprockets/bumble_d/config.rb', line 6 def babel_config_version @babel_config_version end |
#babel_options ⇒ Object
Returns the value of attribute babel_options.
6 7 8 |
# File 'lib/sprockets/bumble_d/config.rb', line 6 def @babel_options end |
#file_extension ⇒ Object
Returns the value of attribute file_extension.
6 7 8 |
# File 'lib/sprockets/bumble_d/config.rb', line 6 def file_extension @file_extension end |
#globals_map ⇒ Object (readonly)
Returns the value of attribute globals_map.
11 12 13 |
# File 'lib/sprockets/bumble_d/config.rb', line 11 def globals_map @globals_map end |
#root_dir ⇒ Object
Returns the value of attribute root_dir.
6 7 8 |
# File 'lib/sprockets/bumble_d/config.rb', line 6 def root_dir @root_dir end |
#transform_to_umd ⇒ Object
Returns the value of attribute transform_to_umd.
6 7 8 |
# File 'lib/sprockets/bumble_d/config.rb', line 6 def transform_to_umd @transform_to_umd end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
23 24 25 |
# File 'lib/sprockets/bumble_d/config.rb', line 23 def configure yield self end |
#register_globals(globals_map) ⇒ Object
27 28 29 30 31 32 33 34 35 |
# File 'lib/sprockets/bumble_d/config.rb', line 27 def register_globals(globals_map) duplicate_keys = @globals_map.keys & globals_map.keys unless duplicate_keys.empty? = "Duplicate keys registered: #{duplicate_keys}" raise ConflictingGlobalRegistrationError, end @globals_map = @globals_map.merge(globals_map).freeze end |