Class: Hokusai::Ast::Func

Inherits:
Object
  • Object
show all
Defined in:
ui/src/hokusai/ast.rb

Overview

A node representing a function call

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(raw) ⇒ Func

Returns a new instance of Func.



47
48
49
# File 'ui/src/hokusai/ast.rb', line 47

def initialize(raw)
  @raw = raw
end

Instance Attribute Details

#rawObject (readonly)

Returns the value of attribute raw.



45
46
47
# File 'ui/src/hokusai/ast.rb', line 45

def raw
  @raw
end

Instance Method Details

#argsArray(String)

Args of the func eg @target=“run_this(one, two)” the args are [one, two]

Returns:

  • (Array(String))


65
66
67
68
69
# File 'ui/src/hokusai/ast.rb', line 65

def args
  @strargs ||= raw[:strargs]
    .read_array_of_type(:pointer, :read_pointer, raw[:args_len])
    .map(&:read_string).freeze
end

#methodString

Name of the func eg @target=“run_this(one,two)” the name is ‘run_this`

Returns:

  • (String)


56
57
58
# File 'ui/src/hokusai/ast.rb', line 56

def method
  @method ||= raw[:function].freeze
end