Class: Avm::SourceGenerators::OptionList
- Inherits:
-
Object
- Object
- Avm::SourceGenerators::OptionList
- Defined in:
- lib/avm/source_generators/option_list.rb
Instance Method Summary collapse
- #immutable_option ⇒ Object
- #option(*args) ⇒ Object
- #validate(options_hash) ⇒ Hash<Symbol, String>
- #validate_option(option_name) ⇒ Object
Instance Method Details
#immutable_option ⇒ Object
12 |
# File 'lib/avm/source_generators/option_list.rb', line 12 alias immutable_option option |
#option(*args) ⇒ Object
14 15 16 |
# File 'lib/avm/source_generators/option_list.rb', line 14 def option(*args) immutable_option(::Avm::SourceGenerators::Option.new(*args)) end |
#validate(options_hash) ⇒ Hash<Symbol, String>
19 20 21 |
# File 'lib/avm/source_generators/option_list.rb', line 19 def validate() .transform_keys { |k| validate_option(k) } end |
#validate_option(option_name) ⇒ Object
23 24 25 26 27 28 29 |
# File 'lib/avm/source_generators/option_list.rb', line 23 def validate_option(option_name) option_name = option_name.to_sym return option_name if .any? { |option| option.name == option_name } raise "No option found with name \"#{option_name}\"" end |