Skip to content
On this page

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class · Ruby 3.4

Prism::AssocNode

< Prism::Node 13 instance methods 2 class methods

Represents a hash key/value pair.

{ a => b }
  ^^^^^^

Class methods 2

Instance methods 13

Attributes

key

Read

The key of the association. This can be any [non-void expression](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

{ a: b }
  ^

{ foo => bar }
  ^^^

{ def a; end => 1 }
  ^^^^^^^^^^
Read

The value of the association, if present. This can be any [non-void expression](github.com/ruby/prism/blob/main/docs/parsing_rules.md#non-void-expression).

{ foo => bar }
         ^^^

{ x: 1 }
     ^