Class: PuppetLanguageServer::Sidecar::Protocol::PuppetClass

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

#docObject

Returns the value of attribute doc.



161
162
163
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 161

def doc
  @doc
end

#parametersObject

Returns the value of attribute parameters.



161
162
163
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 161

def parameters
  @parameters
end

Instance Method Details

#from_h!(value) ⇒ Object



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 170

def from_h!(value)
  super

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

#to_hObject



163
164
165
166
167
168
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 163

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