Module: Crayfish::ActionView

Included in:
ActionView::Base
Defined in:
lib/crayfish/action_view.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(id, *args, &block) ⇒ Object (private)



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/crayfish/action_view.rb', line 79

def method_missing(id,*args,&block)
  case(id.to_s)
  when /^fill_and_stroke_(.*)/
    flush
    @pdf.send($1,*args,&block); @pdf.fill_and_stroke
  when /^stroke_(.*)/
    flush
    @pdf.send($1,*args,&block); @pdf.stroke
  when /^fill_(.*)/
    flush
    @pdf.send($1,*args,&block); @pdf.fill
  else
    if @pdf.respond_to?(id)
      flush
      @pdf.send(id,*args,&block)
    else
      super
    end
  end
end

Instance Method Details

#render(*args) ⇒ Object



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/crayfish/action_view.rb', line 26

def render *args
  if @branch_level
    @branch_level += 1
    if @options[:html]
      super
    else
      stack = @output_buffer
      @output_buffer = ::ActionView::OutputBuffer.new
      super
      @output_buffer = stack
    end
    @branch_level -= 1
  else
    super
  end
end