Module: Leftovers::AST::HasArguments
- Defined in:
- lib/leftovers/ast/has_arguments.rb
Instance Method Summary collapse
Instance Method Details
#kwargs ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/leftovers/ast/has_arguments.rb', line 18 def kwargs @memo.fetch(:kwargs) do @memo[:kwargs] = begin args = arguments next unless args last_arg = args[-1] last_arg if last_arg&.hash? end end end |
#positional_arguments ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/leftovers/ast/has_arguments.rb', line 6 def positional_arguments @memo.fetch(:positional_arguments) do @memo[:positional_arguments] = begin if kwargs arguments[0...-1] else arguments end end end end |