Class: FluentCommandBuilder::CommandBuilderConfig

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent_command_builder/internal/command_builder_config.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(command_name, version = nil) ⇒ CommandBuilderConfig

Returns a new instance of CommandBuilderConfig.



13
14
15
16
17
18
19
20
21
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 13

def initialize(command_name, version=nil)
  @path = nil
  @command_name = command_name
  @version = version
  @path_validation_level = :fatal
  @version_validation_level = :fatal
  @path_validator = PathValidator.new self
  @version_validator = nil
end

Instance Attribute Details

#command_nameObject

Returns the value of attribute command_name.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def command_name
  @command_name
end

#pathObject

Returns the value of attribute path.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def path
  @path
end

#path_validation_levelObject

Returns the value of attribute path_validation_level.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def path_validation_level
  @path_validation_level
end

#path_validatorObject

Returns the value of attribute path_validator.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def path_validator
  @path_validator
end

#versionObject

Returns the value of attribute version.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def version
  @version
end

#version_validation_levelObject

Returns the value of attribute version_validation_level.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def version_validation_level
  @version_validation_level
end

#version_validatorObject

Returns the value of attribute version_validator.



9
10
11
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 9

def version_validator
  @version_validator
end

Instance Method Details

#executableObject



34
35
36
37
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 34

def executable
  p = Path.new @path.to_s, @command_name
  p.normalised_path
end

#validate_pathObject



23
24
25
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 23

def validate_path
  @path_validator.validate
end

#validate_versionObject



27
28
29
30
31
32
# File 'lib/fluent_command_builder/internal/command_builder_config.rb', line 27

def validate_version
  return unless @version
  v = @version_validator || VersionValidator.new(@command_name) { |path| GetVersion[path] }
  p = Path.new @path
  v.validate @version, p.evaluated_path
end