Class: FluentCommandBuilder::Path
- Inherits:
-
Object
- Object
- FluentCommandBuilder::Path
- Defined in:
- lib/fluent_command_builder/internal/path.rb
Instance Attribute Summary collapse
-
#is_windows ⇒ Object
Returns the value of attribute is_windows.
-
#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 10 |
# File 'lib/fluent_command_builder/internal/path.rb', line 6 def initialize(*path) path.select! { |p| p unless p == '' } @path = File.join path @is_windows = !ENV['WINDIR'].nil? end |
Instance Attribute Details
#is_windows ⇒ Object
Returns the value of attribute is_windows.
4 5 6 |
# File 'lib/fluent_command_builder/internal/path.rb', line 4 def is_windows @is_windows end |
#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
12 13 14 15 |
# File 'lib/fluent_command_builder/internal/path.rb', line 12 def evaluated_path return unless @path `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 @is_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 |