Class: CBS::Function

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, arguments, block) ⇒ Function

Returns a new instance of Function.



215
216
217
# File 'lib/cbs.rb', line 215

def initialize(name, arguments, block)
  @name, @arguments, @block = name, arguments, block
end

Instance Attribute Details

#argumentsObject

Returns the value of attribute arguments.



214
215
216
# File 'lib/cbs.rb', line 214

def arguments
  @arguments
end

#blockObject

Returns the value of attribute block.



214
215
216
# File 'lib/cbs.rb', line 214

def block
  @block
end

#nameObject

Returns the value of attribute name.



214
215
216
# File 'lib/cbs.rb', line 214

def name
  @name
end

Instance Method Details

#format(first) ⇒ Object



218
219
220
221
222
223
# File 'lib/cbs.rb', line 218

def format(first)
  code = ''
  code += ',' unless first
  code += "\n"
  code += "  #{name} : function#{arguments}#{block.gsub("\n  ", "\n")}"
end