Class: Specdown::Runner

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(file_path) ⇒ Runner

Returns a new instance of Runner.



5
6
7
8
9
# File 'lib/specdown/runner.rb', line 5

def initialize(file_path)
  @file_path = file_path
  @tree   = Parser.parse File.read(file_path)
  @stats  = Stats.new self
end

Instance Attribute Details

#file_pathObject (readonly)

Returns the value of attribute file_path.



3
4
5
# File 'lib/specdown/runner.rb', line 3

def file_path
  @file_path
end

#statsObject (readonly)

Returns the value of attribute stats.



3
4
5
# File 'lib/specdown/runner.rb', line 3

def stats
  @stats
end

Instance Method Details

#file_nameObject



11
12
13
# File 'lib/specdown/runner.rb', line 11

def file_name
  File.basename @file_path
end

#runObject



15
16
17
18
19
20
# File 'lib/specdown/runner.rb', line 15

def run
  EventServer.event :run_starting, self
  depth_first_search @tree.root
  EventServer.event :run_complete, self
  self
end