Class: PuppetLanguageServer::Sidecar::Protocol::PuppetDataType

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

#initializePuppetDataType

Returns a new instance of PuppetDataType.



197
198
199
200
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 197

def initialize
  super
  self.attributes = PuppetDataTypeAttributeList.new
end

Instance Attribute Details

#alias_ofObject

Returns the value of attribute alias_of.



195
196
197
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 195

def alias_of
  @alias_of
end

#attributesObject

Returns the value of attribute attributes.



195
196
197
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 195

def attributes
  @attributes
end

#docObject

Returns the value of attribute doc.



195
196
197
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 195

def doc
  @doc
end

#is_type_aliasObject

Returns the value of attribute is_type_alias.



195
196
197
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 195

def is_type_alias
  @is_type_alias
end

Instance Method Details

#from_h!(value) ⇒ Object



211
212
213
214
215
216
217
218
219
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 211

def from_h!(value)
  super

  self.doc = value['doc']
  self.alias_of = value['alias_of']
  value['attributes'].each { |attr| attributes << PuppetDataTypeAttribute.new.from_h!(attr) } unless value['attributes'].nil?
  self.is_type_alias = value['is_type_alias']
  self
end

#to_hObject



202
203
204
205
206
207
208
209
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 202

def to_h
  super.to_h.merge(
    'doc' => doc,
    'alias_of' => alias_of,
    'attributes' => attributes.map(&:to_h),
    'is_type_alias' => is_type_alias
  )
end