Class: PuppetLanguageServer::Sidecar::Protocol::PuppetType

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

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



351
352
353
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 351

def attributes
  @attributes
end

#docObject

Returns the value of attribute doc.



351
352
353
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 351

def doc
  @doc
end

Instance Method Details

#from_h!(value) ⇒ Object



360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 360

def from_h!(value)
  super

  self.doc = value['doc']
  self.attributes = {}
  unless value['attributes'].nil?
    value['attributes'].each do |attr_name, obj_attr|
      attributes[attr_name.intern] = {
        # TODO: This should be a class, not a hash
        type: value_from_hash(obj_attr, :type).intern,
        doc: value_from_hash(obj_attr, :doc),
        required?: value_from_hash(obj_attr, :required?),
        isnamevar?: value_from_hash(obj_attr, :isnamevar?)
      }
    end
  end
  self
end

#to_hObject



353
354
355
356
357
358
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 353

def to_h
  super.to_h.merge(
    'doc' => doc,
    'attributes' => attributes
  )
end