Class: Rafflesia::HealthData

Inherits:
Types::BaseModel
  • Object
show all
Defined in:
lib/rafflesia/system/health_data.rb

Constant Summary collapse

HASH_ATTRS =
{
  build: :build,
  data_dir: :data_dir,
  dependencies: :dependencies,
  mode: :mode,
  runtime: :runtime,
  runtime_profile: :runtime_profile,
  status: :status,
  version: :version
}.freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(json) ⇒ HealthData

Returns a new instance of HealthData.



29
30
31
32
33
34
35
36
37
38
39
40
# File 'lib/rafflesia/system/health_data.rb', line 29

def initialize(json)
  super()
  hash = self.class.normalize(json)
  @build = hash[:build] ? Rafflesia::BuildInfo.new(hash[:build]) : nil
  @data_dir = hash[:data_dir]
  @dependencies = (hash[:dependencies] || []).map { |item| item ? Rafflesia::DependencyStatus.new(item) : nil }
  @mode = hash[:mode]
  @runtime = (hash[:runtime] || []).map { |item| item ? Rafflesia::RuntimeStatus.new(item) : nil }
  @runtime_profile = hash[:runtime_profile]
  @status = hash[:status]
  @version = hash[:version]
end

Instance Attribute Details

#buildObject

Returns the value of attribute build.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def build
  @build
end

#data_dirObject

Returns the value of attribute data_dir.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def data_dir
  @data_dir
end

#dependenciesObject

Returns the value of attribute dependencies.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def dependencies
  @dependencies
end

#modeObject

Returns the value of attribute mode.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def mode
  @mode
end

#runtimeObject

Returns the value of attribute runtime.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def runtime
  @runtime
end

#runtime_profileObject

Returns the value of attribute runtime_profile.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def runtime_profile
  @runtime_profile
end

#statusObject

Returns the value of attribute status.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def status
  @status
end

#versionObject

Returns the value of attribute version.



19
20
21
# File 'lib/rafflesia/system/health_data.rb', line 19

def version
  @version
end