Class: ProconBypassMan::ButtonsSettingConfiguration::MetadataLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb

Constant Summary collapse

EMPTY_VERSION =
'0.0.0'

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(setting_path) ⇒ MetadataLoader

Returns a new instance of MetadataLoader.

Parameters:

  • setting_path (String)


13
14
15
16
17
18
# File 'lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb', line 13

def initialize(setting_path)
  content = File.read(setting_path)
  if(matched = content.match(/metadata-required_pbm_version: ([\d.]+)/))
    @required_pbm_version = matched[1]
  end
end

Class Method Details

.load(setting_path:) ⇒ MetadataLoader

Parameters:

  • setting_path (String)

Returns:



8
9
10
# File 'lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb', line 8

def self.load(setting_path: )
  self.new(setting_path)
end

Instance Method Details

#required_pbm_versionString

Returns:

  • (String)


21
22
23
24
# File 'lib/procon_bypass_man/buttons_setting_configuration/metadata_loader.rb', line 21

def required_pbm_version
  return EMPTY_VERSION unless defined?(@required_pbm_version)
  return @required_pbm_version if @required_pbm_version
end