Skip to content
This repository
Browse code

Whitespace and example identation

  • Loading branch information...
commit 9f9a02af86dee5372aae2bd84a5220245bee8706 1 parent e8ef58a
Josep M. Bach authored August 14, 2010 fxn committed August 15, 2010
14  activesupport/lib/active_support/lazy_load_hooks.rb
@@ -5,17 +5,17 @@
5 5
 #
6 6
 # Here is an example where +on_load+ method is called to register a hook.
7 7
 #
8  
-#  initializer "active_record.initialize_timezone" do
9  
-#    ActiveSupport.on_load(:active_record) do
10  
-#      self.time_zone_aware_attributes = true
11  
-#      self.default_timezone = :utc
12  
-#    end
13  
-#  end
  8
+#   initializer "active_record.initialize_timezone" do
  9
+#     ActiveSupport.on_load(:active_record) do
  10
+#       self.time_zone_aware_attributes = true
  11
+#       self.default_timezone = :utc
  12
+#     end
  13
+#   end
14 14
 #
15 15
 # When the entirety of +activerecord/lib/active_record/base.rb+ has been evaluated then +run_load_hooks+ is invoked.
16 16
 # The very last line of +activerecord/lib/active_record/base.rb+ is:
17 17
 #
18  
-#  ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
  18
+#   ActiveSupport.run_load_hooks(:active_record, ActiveRecord::Base)
19 19
 #
20 20
 module ActiveSupport
21 21
   @load_hooks = Hash.new {|h,k| h[k] = [] }
4  activesupport/lib/active_support/log_subscriber.rb
@@ -4,7 +4,7 @@
4 4
 module ActiveSupport
5 5
   # ActiveSupport::LogSubscriber is an object set to consume ActiveSupport::Notifications
6 6
   # with solely purpose of logging. The log subscriber dispatches notifications to a
7  
-  # regirested object based on its given namespace.
  7
+  # registered object based on its given namespace.
8 8
   #
9 9
   # An example would be Active Record log subscriber responsible for logging queries:
10 10
   #
@@ -16,7 +16,7 @@ module ActiveSupport
16 16
   #     end
17 17
   #   end
18 18
   #
19  
-  # And it's finally registed as:
  19
+  # And it's finally registered as:
20 20
   #
21 21
   #   ActiveRecord::LogSubscriber.attach_to :active_record
22 22
   #
1  activesupport/lib/active_support/rescuable.rb
@@ -47,6 +47,7 @@ module ClassMethods
47 47
       #         exception.record.new_record? ? ...
48 48
       #       end
49 49
       #   end
  50
+      #
50 51
       def rescue_from(*klasses, &block)
51 52
         options = klasses.extract_options!
52 53
 
14  activesupport/lib/active_support/secure_random.rb
@@ -46,8 +46,10 @@ module ActiveSupport
46 46
     #  p SecureRandom.random_bytes(10) # => "\016\t{\370g\310pbr\301"
47 47
     #  p SecureRandom.random_bytes(10) # => "\323U\030TO\234\357\020\a\337"
48 48
     #  ...
  49
+    #
49 50
     module SecureRandom
50  
-      # SecureRandom.random_bytes generates a random binary string.
  51
+
  52
+      # Generates a random binary string.
51 53
       #
52 54
       # The argument n specifies the length of the result string.
53 55
       #
@@ -56,6 +58,7 @@ module SecureRandom
56 58
       #
57 59
       # If secure random number generator is not available,
58 60
       # NotImplementedError is raised.
  61
+      #
59 62
       def self.random_bytes(n=nil)
60 63
         n ||= 16
61 64
 
@@ -124,7 +127,7 @@ def self.random_bytes(n=nil)
124 127
         raise NotImplementedError, "No random device"
125 128
       end
126 129
 
127  
-      # SecureRandom.hex generates a random hex string.
  130
+      # Generates a random hex string.
128 131
       #
129 132
       # The argument n specifies the length of the random length.
130 133
       # The length of the result string is twice of n.
@@ -134,11 +137,12 @@ def self.random_bytes(n=nil)
134 137
       #
135 138
       # If secure random number generator is not available,
136 139
       # NotImplementedError is raised.
  140
+      #
137 141
       def self.hex(n=nil)
138 142
         random_bytes(n).unpack("H*")[0]
139 143
       end
140 144
 
141  
-      # SecureRandom.base64 generates a random base64 string.
  145
+      # Generates a random base64 string.
142 146
       #
143 147
       # The argument n specifies the length of the random length.
144 148
       # The length of the result string is about 4/3 of n.
@@ -148,11 +152,12 @@ def self.hex(n=nil)
148 152
       #
149 153
       # If secure random number generator is not available,
150 154
       # NotImplementedError is raised.
  155
+      #
151 156
       def self.base64(n=nil)
152 157
         [random_bytes(n)].pack("m*").delete("\n")
153 158
       end
154 159
 
155  
-      # SecureRandom.random_number generates a random number.
  160
+      # Generates a random number.
156 161
       #
157 162
       # If an positive integer is given as n,
158 163
       # SecureRandom.random_number returns an integer:
@@ -161,6 +166,7 @@ def self.base64(n=nil)
161 166
       # If 0 is given or an argument is not given,
162 167
       # SecureRandom.random_number returns an float:
163 168
       # 0.0 <= SecureRandom.random_number() < 1.0.
  169
+      #
164 170
       def self.random_number(n=0)
165 171
         if 0 < n
166 172
           hex = n.to_s(16)
2  activesupport/lib/active_support/time_with_zone.rb
@@ -32,6 +32,7 @@ module ActiveSupport
32 32
   #   t > Time.utc(1999)                    # => true
33 33
   #   t.is_a?(Time)                         # => true
34 34
   #   t.is_a?(ActiveSupport::TimeWithZone)  # => true
  35
+  #
35 36
   class TimeWithZone
36 37
     def self.name
37 38
       'Time' # Report class name as 'Time' to thwart type checking
@@ -127,6 +128,7 @@ def xmlschema(fraction_digits = 0)
127 128
     #   # With ActiveSupport::JSON::Encoding.use_standard_json_time_format = false
128 129
     #   Time.utc(2005,2,1,15,15,10).in_time_zone.to_json
129 130
     #   # => "2005/02/01 15:15:10 +0000"
  131
+    #
130 132
     def as_json(options = nil)
131 133
       if ActiveSupport::JSON::Encoding.use_standard_json_time_format
132 134
         xmlschema

0 notes on commit 9f9a02a

Please sign in to comment.
Something went wrong with that request. Please try again.