Class: Rescik

Inherits:
Prawn::Document
  • Object
show all
Defined in:
lib/rescik.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.generate(outfile, &block) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/rescik.rb', line 9

def self.generate(outfile, &block)
  @doc = new(:top_margin => 0.75.in,
             :bottom_margin => 1.in,
             :left_margin => 1.in,
             :right_margin => 1.in,
             :page_size => [7.0.in, 9.19.in])
  @doc.instance_eval(&block)
  @doc.render_file(outfile)
end

Instance Method Details

#description(desc) ⇒ Object



26
27
28
29
30
31
# File 'lib/rescik.rb', line 26

def description(desc)
  move_down 10
  text "Description:", :style => :bold, :size => 9
  move_down 5
  text desc, :size => 9
end

#example_response(response) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/rescik.rb', line 45

def example_response(response)
  move_down 10
  text "Response example:", :style => :bold, :size => 9
  move_down 5
  text response, :size => 9
  move_down 15
end

#method(type, path) ⇒ Object



19
20
21
22
23
24
# File 'lib/rescik.rb', line 19

def method(type, path)
  text "#{type.upcase} #{path}", :size => 11, :style => :bold
  stroke_horizontal_rule
  move_down 15
  yield
end

#params(info, opts = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/rescik.rb', line 33

def params(info, opts = {})
  move_down 10
  text "Parameters", :style => :bold, :size => 9
  text info, :size => 9
  move_down 5
  opts.each { |k, v|
    text "- #{k}", :style => :bold, :size => 9
    text "(type:  #{v.first})   #{v.last || ""}", :size => 9
    move_down(3)
  }
end