public
Fork of halorgium/mephisto
Description: A mirror of the mephisto code-base
Homepage: http://mephistoblog.com/
Clone URL: git://github.com/technoweenie/mephisto.git
Search Repo:
Click here to lend your support to: mephisto and make a donation at www.pledgie.com !
 - Remove the breakpoint server from dev to prevent whining
 - fix the expiring_attr_reader problem




git-svn-id: http://svn.techno-weenie.net/projects/mephisto/trunk@2997 
567b1171-46fb-0310-a4c9-b4bef9110e78
imajes (author)
Thu Oct 18 14:48:00 -0700 2007
commit  293e143d29f655f721dfe26b58bc543cc5eac887
tree    a1aa5e141bf4b43fc211bac1d7f8779444c89ece
parent  751873d9abd92e4b4b59324abc190481daf73951
...
13
14
15
 
 
 
 
16
17
18
...
13
14
15
16
17
18
19
20
21
22
0
@@ -13,6 +13,10 @@
0
 
0
 # requires vendor-loaded redcloth
0
 require 'RedCloth-3.0.4/lib/redcloth' unless Object.const_defined?(:RedCloth)
0
+
0
+# extend ruby defaults - this is needed here before we use it
0
+require File.join(File.dirname(__FILE__), '../lib/mephisto/ruby_extensions')
0
+
0
 Rails::Initializer.run do |config|
0
   # Settings in config/environments/* take precedence those specified here
0
   
...
8
9
10
11
12
13
14
15
16
...
8
9
10
 
 
 
11
12
13
0
@@ -8,9 +8,6 @@
0
 # Log error messages when you accidentally call methods on nil.
0
 config.whiny_nils = true
0
 
0
-# Enable the breakpoint server that script/breakpointer connects to
0
-config.breakpoint_server = true
0
-
0
 # Show full error reports and disable caching
0
 config.action_controller.consider_all_requests_local = true
0
 config.action_controller.perform_caching = false
...
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
0
@@ -1 +1,37 @@
0
+Module.class_eval do
0
+ # Creates an expiring method that is called once, and overwrites itself so future calls are faster. It does this
0
+ # by setting an instance variable and an attr_reader on the singleton class. Other instances of this object are
0
+ # not affected.
0
+ #
0
+ # (example taken from http://redhanded.hobix.com/inspect/methodsThatSelfDestruct.html)
0
+ # class Hit
0
+ # expiring_attr_reader :country, %(`geoiplookup #{@ip}`.chomp.gsub(/^GeoIP Country Edition: /,""))
0
+ #
0
+ # def initialize(ip)
0
+ # @ip = ip
0
+ # end
0
+ # end
0
+ #
0
+ # A better idea would be to refactor the expensive code into a method:
0
+ #
0
+ # class Hit
0
+ # expiring_attr_reader :country, "self.class.geoiplookup @ip"
0
+ #
0
+ # def initialize(ip)
0
+ # @ip = ip
0
+ # end
0
+ #
0
+ # def self.geoiplookup(ip)
0
+ # `geoiplookup #{ip}`.chomp.gsub(/^GeoIP Country Edition: /,"")
0
+ # end
0
+ # end
0
+ def expiring_attr_reader(method_name, value)
0
+ class_eval(<<-EOS, __FILE__, __LINE__)
0
+ def #{method_name}
0
+ class << self; attr_reader :#{method_name}; end
0
+ @#{method_name} = eval(%(#{value}))
0
+ end
0
+ EOS
0
+ end
0
+end
...
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
...
35
36
37
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
38
39
40
0
@@ -35,41 +35,6 @@
0
 end
0
 
0
 Module.class_eval do
0
- # Creates an expiring method that is called once, and overwrites itself so future calls are faster. It does this
0
- # by setting an instance variable and an attr_reader on the singleton class. Other instances of this object are
0
- # not affected.
0
- #
0
- # (example taken from http://redhanded.hobix.com/inspect/methodsThatSelfDestruct.html)
0
- # class Hit
0
- # expiring_attr_reader :country, %(`geoiplookup #{@ip}`.chomp.gsub(/^GeoIP Country Edition: /,""))
0
- #
0
- # def initialize(ip)
0
- # @ip = ip
0
- # end
0
- # end
0
- #
0
- # A better idea would be to refactor the expensive code into a method:
0
- #
0
- # class Hit
0
- # expiring_attr_reader :country, "self.class.geoiplookup @ip"
0
- #
0
- # def initialize(ip)
0
- # @ip = ip
0
- # end
0
- #
0
- # def self.geoiplookup(ip)
0
- # `geoiplookup #{ip}`.chomp.gsub(/^GeoIP Country Edition: /,"")
0
- # end
0
- # end
0
- def expiring_attr_reader(method_name, value)
0
- class_eval(<<-EOS, __FILE__, __LINE__)
0
- def #{method_name}
0
- class << self; attr_reader :#{method_name}; end
0
- @#{method_name} = eval(%(#{value}))
0
- end
0
- EOS
0
- end
0
-
0
   # A hash that maps Class names to an array of Modules to mix in when the class is instantiated.
0
   @@class_mixins = {}
0
   mattr_reader :class_mixins

Comments

    No one has commented yet.