Class: Docspec::Document

Inherits:
Object
  • Object
show all
Includes:
Testable
Defined in:
lib/docspec/document.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from Testable

#failed_examples, #success?, #test

Constructor Details

#initialize(markdown) ⇒ Document

Returns a new instance of Document.



10
11
12
# File 'lib/docspec/document.rb', line 10

def initialize(markdown)
  @markdown = markdown
end

Instance Attribute Details

#filenameObject (readonly)

Returns the value of attribute filename.



4
5
6
# File 'lib/docspec/document.rb', line 4

def filename
  @filename
end

#markdownObject (readonly)

Returns the value of attribute markdown.



4
5
6
# File 'lib/docspec/document.rb', line 4

def markdown
  @markdown
end

Class Method Details

.from_file(filename) ⇒ Object



6
7
8
# File 'lib/docspec/document.rb', line 6

def self.from_file(filename)
  new File.read(filename)
end

Instance Method Details

#beforeObject



18
19
20
# File 'lib/docspec/document.rb', line 18

def before
  @before ||= {}
end

#examplesObject



14
15
16
# File 'lib/docspec/document.rb', line 14

def examples
  @examples ||= examples!
end