Class: Rampi::Func
Instance Attribute Summary collapse
-
#args ⇒ Object
Returns the value of attribute args.
-
#kwargs ⇒ Object
Returns the value of attribute kwargs.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #accept(visitor) ⇒ Object
-
#initialize(name, *args, **kwargs) ⇒ Func
constructor
A new instance of Func.
- #to_s ⇒ Object (also: #inspect)
Methods inherited from Node
#!=, #%, #&, #*, #**, #+, #-, #-@, #/, #<, #<<, #<=, #==, #>, #>=, #>>, #^, #|, #~
Constructor Details
#initialize(name, *args, **kwargs) ⇒ Func
Returns a new instance of Func.
65 66 67 68 69 |
# File 'lib/rampi/node.rb', line 65 def initialize(name, *args, **kwargs) @name = name @args = args @kwargs = kwargs end |
Instance Attribute Details
#args ⇒ Object
Returns the value of attribute args.
63 64 65 |
# File 'lib/rampi/node.rb', line 63 def args @args end |
#kwargs ⇒ Object
Returns the value of attribute kwargs.
63 64 65 |
# File 'lib/rampi/node.rb', line 63 def kwargs @kwargs end |
#name ⇒ Object
Returns the value of attribute name.
63 64 65 |
# File 'lib/rampi/node.rb', line 63 def name @name end |
Instance Method Details
#accept(visitor) ⇒ Object
78 79 80 |
# File 'lib/rampi/node.rb', line 78 def accept(visitor) visitor.visit_func(self) end |
#to_s ⇒ Object Also known as: inspect
71 72 73 74 75 |
# File 'lib/rampi/node.rb', line 71 def to_s kwargs_s = @kwargs.map { |k, v| "#{k}: #{v}" }.join(', ') args_s = @args.join(', ') "#{@name}(#{args_s}#{!kwargs_s.empty? ? ", #{kwargs_s}" : ''})" end |