Class: Yard2steep::AST::PNode

Inherits:
Object
  • Object
show all
Defined in:
lib/yard2steep/ast/p_node.rb

Constant Summary collapse

STYLE =
{
  normal:               "STYLE.normal",
  normal_with_default:  "STYLE.normal_with_default",
  keyword:              "STYLE.keyword",
  keyword_with_default: "STYLE.keyword_with_default",
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type_node:, style:) ⇒ PNode

Returns a new instance of PNode.

Parameters:



16
17
18
19
20
21
# File 'lib/yard2steep/ast/p_node.rb', line 16

def initialize(type_node:, style:)
  Util.assert! { type_node.is_a?(AST::PTypeNode) }
  Util.assert! { STYLE.values.include?(style) }
  @type_node = type_node
  @style     = style
end

Instance Attribute Details

#styleObject (readonly)

Returns the value of attribute style.



5
6
7
# File 'lib/yard2steep/ast/p_node.rb', line 5

def style
  @style
end

#type_nodeObject (readonly)

Returns the value of attribute type_node.



5
6
7
# File 'lib/yard2steep/ast/p_node.rb', line 5

def type_node
  @type_node
end