Class: Ratbug::GenerateConfig
- Inherits:
-
Object
- Object
- Ratbug::GenerateConfig
- Defined in:
- lib/ratbug/generate_config.rb
Constant Summary collapse
- VALID_OPTION_KEYS =
%i[ enabled_outputs ts_prefer_type ts_enum_output_type ts_prefer_undefined use_only_schema output_dir table_name_to_model_converter omit_timestamps ].freeze
Instance Attribute Summary collapse
-
#override_options ⇒ Object
timestamp jbuilder indent usetab.
Instance Method Summary collapse
-
#initialize(**options) ⇒ GenerateConfig
constructor
A new instance of GenerateConfig.
- #options ⇒ Hash<Symbol, Object>
- #set(key, value) ⇒ Object
Constructor Details
#initialize(**options) ⇒ GenerateConfig
Returns a new instance of GenerateConfig.
19 20 21 22 23 24 |
# File 'lib/ratbug/generate_config.rb', line 19 def initialize(**) @override_options = {} .each do |key, value| set(key, value) end end |
Instance Attribute Details
#override_options ⇒ Object
timestamp jbuilder indent usetab
17 18 19 |
# File 'lib/ratbug/generate_config.rb', line 17 def @override_options end |
Instance Method Details
#options ⇒ Hash<Symbol, Object>
34 35 36 37 38 39 |
# File 'lib/ratbug/generate_config.rb', line 34 def { **, **@override_options } end |
#set(key, value) ⇒ Object
26 27 28 29 30 31 |
# File 'lib/ratbug/generate_config.rb', line 26 def set(key, value) key = key.to_sym puts "warning: GenerateConfig option #{key} has duplicated." unless @override_options[key].nil? @override_options[key] = value self end |