Class: PuppetLanguageServer::Sidecar::Protocol::BasePuppetObjectList

Inherits:
Array
  • Object
show all
Includes:
Base
Defined in:
lib/puppet-languageserver/sidecar_protocol.rb

Instance Method Summary collapse

Instance Method Details

#child_typeObject



135
136
137
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 135

def child_type
  Object
end

#from_json!(json_string) ⇒ Object



126
127
128
129
130
131
132
133
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 126

def from_json!(json_string)
  obj = ::JSON.parse(json_string)
  obj.each do |child_hash|
    child = child_type.new
    self << child.from_h!(child_hash)
  end
  self
end

#to_json(*options) ⇒ Object



122
123
124
# File 'lib/puppet-languageserver/sidecar_protocol.rb', line 122

def to_json(*options)
  "[#{map { |item| item.to_json(options) }.join(',')}]"
end