lib/io_streams/path.rb in iostreams-1.0.0.beta7 vs lib/io_streams/path.rb in iostreams-1.0.0
- old
+ new
@@ -6,11 +6,11 @@
raise(ArgumentError, 'Path cannot be nil') if path.nil?
raise(ArgumentError, "Path must be a string: #{path.inspect}, class: #{path.class}") unless path.is_a?(String)
@path = path.frozen? ? path : path.dup.freeze
@io_stream = nil
- @streams = nil
+ @builder = nil
end
# If elements already contains the current path then it is used as is without
# adding the current path for a second time
def join(*elements)
@@ -18,11 +18,11 @@
elements = elements.collect(&:to_s)
relative = ::File.join(*elements)
new_path = dup
- new_path.streams = nil
+ new_path.builder = nil
new_path.path = relative.start_with?(path) ? relative : ::File.join(path, relative)
new_path
end
def relative?
@@ -115,11 +115,11 @@
# IOStreams.path("foo.").directory #=> "."
# IOStreams.path("test").directory #=> "."
# IOStreams.path(".profile").directory #=> "."
def directory
new_path = dup
- new_path.streams = nil
+ new_path.builder = nil
new_path.path = ::File.dirname(path)
new_path
end
# When path is a file, deletes this file.
@@ -186,17 +186,17 @@
path == other.path
end
def inspect
str = "#<#{self.class.name}:#{path}"
- str << " @streams=#{streams.streams.inspect}" if streams.streams
- str << " @options=#{streams.options.inspect}" if streams.options
+ str << " @builder=#{builder.streams.inspect}" if builder.streams
+ str << " @options=#{builder.options.inspect}" if builder.options
str << " pipeline=#{pipeline.inspect}>"
end
private
- def streams
- @streams ||= IOStreams::Streams.new(path)
+ def builder
+ @builder ||= IOStreams::Builder.new(path)
end
end
end