Class: FluentCommandBuilder::Path
- Inherits:
-
Object
- Object
- FluentCommandBuilder::Path
- Defined in:
- lib/fluent_command_builder/internal/path.rb
Instance Attribute Summary collapse
-
#path ⇒ Object
Returns the value of attribute path.
Instance Method Summary collapse
- #evaluated_path ⇒ Object
-
#initialize(*path) ⇒ Path
constructor
A new instance of Path.
- #normalised_path ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(*path) ⇒ Path
Returns a new instance of Path.
6 7 8 9 |
# File 'lib/fluent_command_builder/internal/path.rb', line 6 def initialize(*path) path.select! { |p| p unless p == '' } @path = File.join path end |
Instance Attribute Details
#path ⇒ Object
Returns the value of attribute path.
4 5 6 |
# File 'lib/fluent_command_builder/internal/path.rb', line 4 def path @path end |
Instance Method Details
#evaluated_path ⇒ Object
11 12 13 14 15 |
# File 'lib/fluent_command_builder/internal/path.rb', line 11 def evaluated_path return unless @path # evaluates variables in path e.g. %WINDIR% `echo #{normalised_path}`.strip end |
#normalised_path ⇒ Object
17 18 19 20 |
# File 'lib/fluent_command_builder/internal/path.rb', line 17 def normalised_path return unless @path windows? ? @path.gsub('/', '\\') : @path.gsub('\\', '/') end |
#to_s ⇒ Object
22 23 24 |
# File 'lib/fluent_command_builder/internal/path.rb', line 22 def to_s evaluated_path end |