Class: PuppetLanguageServer::Sidecar::Protocol::PuppetFunction

Inherits:
BasePuppetObject show all
Defined in:
lib/puppet-languageserver/sidecar_protocol.rb

Instance Attribute Summary collapse

Attributes inherited from BasePuppetObject

#calling_source, #char, #key, #length, #line, #source

Instance Method Summary collapse

Methods inherited from BaseClass

#==, #eql?, #from_json!, #hash, #to_json

Methods included from Base

#from_json!, #to_json

Constructor Details

#initializePuppetFunction

Returns a new instance of PuppetFunction.



260
261
262
263
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 260

def initialize
  super
  self.signatures = PuppetFunctionSignatureList.new
end

Instance Attribute Details

#docObject

Returns the value of attribute doc.



256
257
258
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 256

def doc
  @doc
end

#function_versionObject

The version of this function, typically 3 or 4.



258
259
260
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 258

def function_version
  @function_version
end

#signaturesObject

Returns the value of attribute signatures.



256
257
258
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 256

def signatures
  @signatures
end

Instance Method Details

#from_h!(value) ⇒ Object



273
274
275
276
277
278
279
280
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 273

def from_h!(value)
  super

  self.doc = value['doc']
  self.function_version = value['function_version']
  value['signatures'].each { |sig| signatures << PuppetFunctionSignature.new.from_h!(sig) } unless value['signatures'].nil?
  self
end

#to_hObject



265
266
267
268
269
270
271
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 265

def to_h
  super.to_h.merge(
    'doc' => doc,
    'function_version' => function_version,
    'signatures' => signatures.map(&:to_h)
  )
end