Method: YARD::CodeObjects::ExtraFileObject#initialize

Defined in:
lib/yard/code_objects/extra_file_object.rb

#initialize(filename, contents = nil) ⇒ ExtraFileObject

Creates a new extra file object.

Parameters:

  • filename (String)

    the location on disk of the file

  • contents (String) (defaults to: nil)

    the file contents. If not set, the contents will be read from disk using the filename.



18
19
20
21
22
23
24
25
26
# File 'lib/yard/code_objects/extra_file_object.rb', line 18

def initialize(filename, contents = nil)
  self.filename = filename
  self.name = File.basename(filename).gsub(/\.[^.]+$/, '')
  self.attributes = SymbolHash.new(false)
  @original_contents = contents
  @parsed = false
  @locale = nil
  ensure_parsed
end