Class: JsxRosetta::IR::StimulusMethod
- Inherits:
-
Data
- Object
- Data
- JsxRosetta::IR::StimulusMethod
- Includes:
- Node
- Defined in:
- lib/jsx_rosetta/ir/types.rb
Overview
A handler method to be emitted on the generated Stimulus controller. Body translation is deferred to the human reviewer; we preserve the original JS body verbatim.
name : String — camelCase Stimulus method name (uniquified
when two handlers collide on the same base name).
body_source : String — verbatim JS body (the entire arrow function
or the function expression body), preserved as a
comment in the emitted controller skeleton.
original_name : String — the requested base name before uniquification.
Equals `name` when there was no collision. When
`name != original_name`, backends emit a collision
marker comment in the generated controller JS so the
reviewer can see the silent rename.
params : [String | nil] — original arrow/function parameter
names (e.g. `["e"]`, `["event"]`, or `[]` for
`() => …`). A `nil` entry signals a non-identifier
param (destructured `({target}) =>`, rest `(...args) =>`)
that the pasted body can't safely reference — backends
bail to the TODO form when any entry is nil.
body_is_block : Boolean — true when the arrow body was a BlockStatement
(`(e) => { … }`), false for an expression-form body
(`(e) => doX(e)`). Backends use this to decide whether
to strip outer braces when pasting verbatim.
Instance Attribute Summary collapse
-
#body_is_block ⇒ Object
readonly
Returns the value of attribute body_is_block.
-
#body_source ⇒ Object
readonly
Returns the value of attribute body_source.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#original_name ⇒ Object
readonly
Returns the value of attribute original_name.
-
#params ⇒ Object
readonly
Returns the value of attribute params.
Instance Attribute Details
#body_is_block ⇒ Object (readonly)
Returns the value of attribute body_is_block
473 474 475 |
# File 'lib/jsx_rosetta/ir/types.rb', line 473 def body_is_block @body_is_block end |
#body_source ⇒ Object (readonly)
Returns the value of attribute body_source
473 474 475 |
# File 'lib/jsx_rosetta/ir/types.rb', line 473 def body_source @body_source end |
#name ⇒ Object (readonly)
Returns the value of attribute name
473 474 475 |
# File 'lib/jsx_rosetta/ir/types.rb', line 473 def name @name end |
#original_name ⇒ Object (readonly)
Returns the value of attribute original_name
473 474 475 |
# File 'lib/jsx_rosetta/ir/types.rb', line 473 def original_name @original_name end |
#params ⇒ Object (readonly)
Returns the value of attribute params
473 474 475 |
# File 'lib/jsx_rosetta/ir/types.rb', line 473 def params @params end |