Class: Interscript::Node::Rule::Funcall

Inherits:
Interscript::Node::Rule show all
Defined in:
lib/interscript/node/rule/funcall.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, reverse_run: nil, **kwargs) ⇒ Funcall

Returns a new instance of Funcall.



3
4
5
6
7
# File 'lib/interscript/node/rule/funcall.rb', line 3

def initialize name, reverse_run: nil, **kwargs
  @name = name
  @reverse_run = reverse_run
  @kwargs = kwargs
end

Instance Attribute Details

#kwargsObject

Returns the value of attribute kwargs.



2
3
4
# File 'lib/interscript/node/rule/funcall.rb', line 2

def kwargs
  @kwargs
end

#nameObject

Returns the value of attribute name.



2
3
4
# File 'lib/interscript/node/rule/funcall.rb', line 2

def name
  @name
end

#reverse_runObject

Returns the value of attribute reverse_run.



2
3
4
# File 'lib/interscript/node/rule/funcall.rb', line 2

def reverse_run
  @reverse_run
end

Instance Method Details

#==Object



21
22
23
# File 'lib/interscript/node/rule/funcall.rb', line 21

def ==
  super && self.name == other.name && self.kwargs == other.kwargs
end

#inspectObject



25
26
27
# File 'lib/interscript/node/rule/funcall.rb', line 25

def inspect
  "#{@name} #{kwargs.inspect[1..-2]}"
end

#reverseObject



16
17
18
19
# File 'lib/interscript/node/rule/funcall.rb', line 16

def reverse
  self.class.new(Interscript::Stdlib.reverse_function[@name.to_sym],
    reverse_run: reverse_run.nil? ? nil : !reverse_run, **kwargs)
end

#to_hashObject



9
10
11
12
13
14
# File 'lib/interscript/node/rule/funcall.rb', line 9

def to_hash
  { :class => self.class.to_s,
    :name => self.name,
    :kwargs => self.kwargs
  }
end