Class: Nodo::Function

Inherits:
Object
  • Object
show all
Defined in:
lib/nodo/function.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, code, source_location, timeout) ⇒ Function

Returns a new instance of Function.



5
6
7
# File 'lib/nodo/function.rb', line 5

def initialize(name, code, source_location, timeout)
  @name, @code, @source_location, @timeout = name, code, source_location, timeout
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/nodo/function.rb', line 3

def code
  @code
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/nodo/function.rb', line 3

def name
  @name
end

#source_locationObject (readonly)

Returns the value of attribute source_location.



3
4
5
# File 'lib/nodo/function.rb', line 3

def source_location
  @source_location
end

#timeoutObject (readonly)

Returns the value of attribute timeout.



3
4
5
# File 'lib/nodo/function.rb', line 3

def timeout
  @timeout
end

Instance Method Details

#to_jsObject



9
10
11
# File 'lib/nodo/function.rb', line 9

def to_js
  "const #{name} = __nodo_klass__.#{name} = (#{code});\n"
end