Class: TestsDoc::File

Inherits:
Struct
  • Object
show all
Defined in:
lib/tests_doc/file.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#optionsObject

Returns the value of attribute options

Returns:

  • (Object)

    the current value of options



5
6
7
# File 'lib/tests_doc/file.rb', line 5

def options
  @options
end

#outputObject

Returns the value of attribute output

Returns:

  • (Object)

    the current value of output



5
6
7
# File 'lib/tests_doc/file.rb', line 5

def output
  @output
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



5
6
7
# File 'lib/tests_doc/file.rb', line 5

def path
  @path
end

Instance Method Details

#write_if_changedObject



7
8
9
10
11
12
13
14
15
# File 'lib/tests_doc/file.rb', line 7

def write_if_changed
  ensure_folder

  if write_output?
    ::File.open(path, 'w+') do |f|
      f.write(output)
    end
  end
end