lib/sinatra/export.rb
def write_path( content: nil, path: nil )
          # These argument checks are for Ruby v2.0 as it
          # doesn't support required keyword args.
          fail ArgumentError, "'content' is a required argument to write_path" if content.nil?
          fail ArgumentError, "'path' is a required argument to write_path" if path.nil?

          if @filters && !@filters.empty?
            content = @filters.inject(content) do |current_content,filter|
              filter.call current_content
            end
          end
          ::File.open(path, 'w+') do |f|
            f.write(content)
          end
        end
# Write the response to file.
# Uses whatever filters were set, on the content.
# @param [String] content
# @param [Pathname,String] path
Write the response to file.
Uses whatever filters were set, on the content.
Write the response to file . Uses whatever filters were set on the content .
def write_path( content: nil, path: nil )
          fail ArgumentError, "'content' is a required argument to write_path" if content.nil?
          fail ArgumentError, "'path' is a required argument to write_path" if path.nil?
          if @filters && !@filters.empty?
            content = @filters.inject(content) do |current_content,filter|
              filter.call current_content
            end
          end
          ::File.open(path, 'w+') do |f|
            f.write(content)
          end
        end
def write_path ( content : nil , path : nil ) fail ArgumentError , "'content' is a required argument to write_path" if content . nil? fail ArgumentError , "'path' is a required argument to write_path" if path . nil? if @filters && ! @filters . empty? content = @filters . inject ( content ) do | current_content , filter | filter . call current_content end end :: File . open ( path , 'w+' ) do | f | f . write ( content ) end end
Write the response to file.
Write the response to file .
# These argument checks are for Ruby v2.0 as it # doesn't support required keyword args.
content
path
None