Module: Ibex::Frontend::ASTRuleDefaults
- Included in:
- Ibex::Frontend::AST::Rule
- Defined in:
- lib/ibex/frontend/ast.rb,
sig/ibex/frontend/ast.rbs
Overview
Keeps the public Rule constructor compatible with ASTs built before parameters and inline rules existed.
Instance Method Summary collapse
-
#initialize(*arguments, **keywords) ⇒ ASTRuleDefaults
A new instance of ASTRuleDefaults.
Instance Method Details
#initialize(*arguments, **keywords) ⇒ ASTRuleDefaults
Returns a new instance of ASTRuleDefaults.
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/ibex/frontend/ast.rb', line 8 def initialize(*arguments, **keywords) if arguments.empty? keywords = keywords.merge(parameters: keywords[:parameters] || [], inline: keywords[:inline] || false) elsif arguments.one? && arguments.first.is_a?(Hash) attributes = arguments.first arguments = [ attributes.merge(parameters: attributes[:parameters] || [], inline: attributes[:inline] || false) ] end super(*arguments, **keywords) # rubocop:disable Style/SuperArguments end |