Class: Module

Inherits:
Object
  • Object
show all
Defined in:
lib/rtm/activerecord/persistent_code_output.rb

Instance Method Summary collapse

Instance Method Details

#module_eval(code, file, line) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/rtm/activerecord/persistent_code_output.rb', line 7

def module_eval(code,file,line)
  module_eval_without_output(code,file,line)
  File.open("/tmp/rtm.rb","a") do |f|
    #puts self, self.class
    @@first_class = true
    @@last_self ||= nil
    if ! @@last_self || @@last_self != self
      f.puts "end\n\n" unless @@first_class
      @@first_class = false
      @@last_self = self
      f.puts "#{self.class.to_s.downcase} #{self}"
    end
    f.puts code
  end
end

#module_eval_without_outputObject



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/rtm/activerecord/persistent_code_output.rb', line 6

def module_eval(code,file,line)
  module_eval_without_output(code,file,line)
  File.open("/tmp/rtm.rb","a") do |f|
    #puts self, self.class
    @@first_class = true
    @@last_self ||= nil
    if ! @@last_self || @@last_self != self
      f.puts "end\n\n" unless @@first_class
      @@first_class = false
      @@last_self = self
      f.puts "#{self.class.to_s.downcase} #{self}"
    end
    f.puts code
  end
end