require 'soar_status' class ClassThatHasFunctionalStatus def initialize SoarStatus::Status.register_functional_status_provider(self) @status = "100" end def functional_status @status end def set_functional_status(status) @status = status end end class ClassThatHasDetailedStatus1 def initialize SoarStatus::Status.register_detailed_status_provider('class_1',self) end def detailed_status { 'stuff' => 'from_class1'} end end class ClassThatHasDetailedStatus2 def initialize SoarStatus::Status.register_detailed_status_provider('class_2',self) end def detailed_status { 'stuff' => 'from_class2'} end end class Main def test_sanity @test_configuration = { 'some' => 'configuration' } @test_environment = { 'some' => 'environment' } #registration of release information SoarStatus::Status.release_commit_hash = '123abc' SoarStatus::Status.release_version = '1.2.3' #registration of configuration and environment detail SoarStatus::Status.configuration = @test_configuration SoarStatus::Status.environment = @test_environment #registration of functional and detailed status providers functional_status_provider = ClassThatHasFunctionalStatus.new detailed_status_provider1 = ClassThatHasDetailedStatus1.new detailed_status_provider2 = ClassThatHasDetailedStatus2.new #retrieval of functional status puts "Functional Status: #{SoarStatus::Status.functional_status}" #retrieval of detailed status puts "Detailed status: #{SoarStatus::Status.detailed_status}" end end main = Main.new main.test_sanity