Class: Opal::Nodes::NodeWithArgs::Shortcut
- Inherits:
-
Struct
- Object
- Struct
- Opal::Nodes::NodeWithArgs::Shortcut
- Defined in:
- opal/lib/opal/nodes/node_with_args/shortcuts.rb
Overview
Shortcuts for the simplest kinds of methods
Instance Attribute Summary collapse
-
#for ⇒ Object
Returns the value of attribute for.
-
#name ⇒ Object
Returns the value of attribute name.
-
#transform ⇒ Object
Returns the value of attribute transform.
-
#when ⇒ Object
Returns the value of attribute when.
Instance Method Summary collapse
Instance Attribute Details
#for ⇒ Object
Returns the value of attribute for
7 8 9 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 7 def for @for end |
#name ⇒ Object
Returns the value of attribute name
7 8 9 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 7 def name @name end |
#transform ⇒ Object
Returns the value of attribute transform
7 8 9 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 7 def transform @transform end |
#when ⇒ Object
Returns the value of attribute when
7 8 9 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 7 def when @when end |
Instance Method Details
#compile(node) ⇒ Object
12 13 14 15 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 12 def compile(node) node.helper name node.instance_exec(&transform) end |
#match?(node) ⇒ Boolean
8 9 10 |
# File 'opal/lib/opal/nodes/node_with_args/shortcuts.rb', line 8 def match?(node) node.instance_exec(&self.when) end |