Class: ReadmeSpec::File

Inherits:
Object
  • Object
show all
Defined in:
lib/readme_spec.rb

Defined Under Namespace

Classes: ReadmeSpecInvalidFileError

Instance Method Summary collapse

Constructor Details

#initialize(path) ⇒ File

Returns a new instance of File.



46
47
48
# File 'lib/readme_spec.rb', line 46

def initialize(path)
  @path = path
end

Instance Method Details

#contentObject



61
62
63
# File 'lib/readme_spec.rb', line 61

def content
  ::File.read(@path)
end

#load_contentObject



50
51
52
53
# File 'lib/readme_spec.rb', line 50

def load_content
  validate
  content
end

#validateObject



55
56
57
58
59
# File 'lib/readme_spec.rb', line 55

def validate
  unless ::File.file?(@path)
    raise ReadmeSpecInvalidFileError, @path
  end
end