Take the 2008 Git User's Survey and help out! [ hide ]

public
Fork of wycats/merb-core
Description: Merb Core: All you need. None you don't.
Homepage: http://www.merbivore.com
Clone URL: git://github.com/auser/merb-core.git
Search Repo:
Added documentation for Config and Exceptions.

Includes documentation for all methods in Config
and for the methods in ControllerExceptions::Base.

Signed-off-by: Michael D. Ivey <ivey@gweezlebur.com>
Janne Asmala (author)
Tue Feb 12 21:01:25 -0800 2008
ivey (committer)
Tue Feb 12 21:16:53 -0800 2008
commit  ecf073ffefe9b59d490f4ab3be2784ea8818b7fc
tree    615bb477cdfbcdfe2e9e847e16cf5094b2fb766b
parent  7551b32f2390cef055f664e75c9d9aafbe3e9464
...
5
6
7
 
 
8
9
10
...
19
20
21
 
 
 
 
 
 
 
 
22
23
24
25
26
 
 
 
 
 
27
28
29
30
 
 
 
 
 
31
32
33
34
 
 
 
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
...
5
6
7
8
9
10
11
12
...
21
22
23
24
25
26
27
28
29
30
31
32
33
34
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
 
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
0
@@ -5,6 +5,8 @@ module Merb
0
   class Config
0
     class << self
0
 
0
+ # ==== Returns
0
+ # Hash:: The defaults for the config.
0
       def defaults
0
         @defaults ||= {
0
           :host => "0.0.0.0",
0
@@ -19,43 +21,86 @@ module Merb
0
         }
0
       end
0
 
0
+ # Yields the configuration.
0
+ #
0
+ # ==== Examples
0
+ # {{[
0
+ # Merb::Config.use do |config|
0
+ # config[:exception_details] = false
0
+ # end
0
+ # ]}}
0
       def use
0
         @configuration ||= {}
0
         yield @configuration
0
       end
0
 
0
+ # ==== Parameters
0
+ # key<Object>:: The key to check.
0
+ #
0
+ # ==== Returns
0
+ # Boolean:: True if the key exists in the config.
0
       def key?(key)
0
         @configuration.key?(key)
0
       end
0
 
0
+ # ==== Parameters
0
+ # key<Object>:: The key to retrieve the parameter for.
0
+ #
0
+ # ==== Returns
0
+ # Object:: The value of the configuration parameter.
0
       def [](key)
0
         (@configuration||={})[key]
0
       end
0
 
0
+ # ==== Parameters
0
+ # key<Object>:: The key to set the parameter for.
0
+ # val<Object>:: The value of the parameter.
0
       def []=(key,val)
0
         @configuration[key] = val
0
       end
0
 
0
+ # ==== Parameters
0
+ # key<Object>:: The key of the parameter to delete.
0
       def delete(key)
0
- @configuration.delete key
0
+ @configuration.delete(key)
0
       end
0
 
0
+ # ==== Parameters
0
+ # key<Object>:: The key to retrieve the parameter for.
0
+ # default<Object>::
0
+ # The default value to return if the parameter is not set.
0
+ #
0
+ # ==== Returns
0
+ # Object:: The value of the configuration parameter or the default.
0
       def fetch(key, default)
0
- @configuration.fetch key, default
0
+ @configuration.fetch(key, default)
0
       end
0
 
0
+ # ==== Returns
0
+ # Hash:: The config as a hash.
0
       def to_hash
0
         @configuration
0
       end
0
 
0
+ # ==== Returns
0
+ # String:: The config as YAML.
0
       def to_yaml
0
         @configuration.to_yaml
0
       end
0
 
0
+ # Sets up the configuration by storing the given settings.
0
+ #
0
+ # ==== Parameters
0
+ # settings<Hash>::
0
+ # Configuration settings to use. These are merged with the defaults.
0
       def setup(settings = {})
0
         @configuration = defaults.merge(settings)
0
       end
0
 
0
+ # Parses the command line arguments and stores them in the config.
0
+ #
0
+ # ==== Parameters
0
+ # argv<String>:: The command line arguments. Defaults to +ARGV+.
0
       def parse_args(argv = ARGV)
0
          @configuration ||= {}
0
          # Our primary configuration hash for the length of this method
...
97
98
99
 
 
100
101
102
103
104
105
 
 
 
 
106
107
108
...
97
98
99
100
101
102
103
104
105
 
 
106
107
108
109
110
111
112
0
@@ -97,12 +97,16 @@ module Merb
0
 
0
     class Base < StandardError #:doc:
0
 
0
+ # ==== Returns
0
+ # String:: The snake cased name of the error without the namespace.
0
       def name
0
         self.class.to_s.snake_case.split('::').last
0
       end
0
       
0
- # Makes it possible to pass a status-code class to render :status
0
-
0
+ # Makes it possible to pass a status-code class to render :status.
0
+ #
0
+ # ==== Returns
0
+ # Fixnum:: The status code of this exception.
0
       def self.to_i
0
         STATUS
0
       end

Comments

    No one has commented yet.