Class: RSpec::ApiGen::Formatter

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-apigen/formatter.rb

Instance Method Summary collapse

Constructor Details

#initialize(output) ⇒ Formatter

Returns a new instance of Formatter.



7
8
# File 'lib/rspec-apigen/formatter.rb', line 7

def initialize(output )
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(m, *a, &b) ⇒ Object



3
4
5
# File 'lib/rspec-apigen/formatter.rb', line 3

def method_missing(m, *a, &b)
  puts "CALLED #{m}"
end

Instance Method Details

#example_failed(example) ⇒ Object



46
47
48
# File 'lib/rspec-apigen/formatter.rb', line 46

def example_failed(example)
  puts "failed"
end

#example_group_started(example_group) ⇒ Object



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/rspec-apigen/formatter.rb', line 15

def example_group_started(example_group)
  # is it a new class ?
  if @current_class != example_group.describes
    @current_class = example_group.describes
    @current_method = nil
    puts "#{@current_class.class} #{example_group.describes}"
  elsif example_group.description == "Public Static Methods"
    puts "  Static Static Methods"
  elsif example_group.description == "Public Instance Methods"
    puts "  Static Instance Methods"
  elsif @current_method
    puts "      #{example_group.description}"
  else
    puts "     Method #{example_group.description}"
    @current_method = example_group.description
  end
#      puts "example_groupstarted #{example_group.describes.class} #{example_group.describes.object_id} #{example_group.description}"
end

#example_passed(example) ⇒ Object



41
42
43
44
# File 'lib/rspec-apigen/formatter.rb', line 41

def example_passed(example)
  puts "         #{example.[:description]}"
  #puts "         #{example.pretty_inspect}"
end

#example_pending(example) ⇒ Object



50
51
52
# File 'lib/rspec-apigen/formatter.rb', line 50

def example_pending(example)
  puts "pending"
end

#example_started(example) ⇒ Object



38
39
# File 'lib/rspec-apigen/formatter.rb', line 38

def example_started(example)
end

#start(example_count) ⇒ Object



10
11
12
13
# File 'lib/rspec-apigen/formatter.rb', line 10

def start(example_count)
  puts "start #{example_count}"
  @current_method = nil
end

#start_dumpObject



34
35
36
# File 'lib/rspec-apigen/formatter.rb', line 34

def start_dump
  puts "start dump"
end