Skip to content
This repository
Browse code

add RDoc for base signature types

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1512 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
commit 1b07366c2fc12dcd38c1498e3239beb03103a09e 1 parent 07f237b
Leon Breedt authored June 25, 2005
8  actionwebservice/lib/action_web_service/api.rb
@@ -8,7 +8,11 @@ module API # :nodoc:
8 8
     #
9 9
     # It is attached to web service implementation classes like
10 10
     # ActionWebService::Base and ActionController::Base derivatives by using
11  
-    # ClassMethods#web_service_api.
  11
+    # <tt>container.web_service_api</tt>, where <tt>container</tt> is an
  12
+    # ActionController::Base or a ActionWebService::Base.
  13
+    #
  14
+    # See ActionWebService::Container::Direct::ClassMethods for an example
  15
+    # of use.
12 16
     class Base
13 17
       # Whether to transform the public API method names into camel-cased names 
14 18
       class_inheritable_option :inflect_names, true
@@ -40,7 +44,7 @@ class << self
40 44
         # A parameter specifier can be one of the following:
41 45
         #
42 46
         # * A symbol or string of representing one of the Action Web Service base types.
43  
-        #   See ActionWebService::Signature for a canonical list of the base types.
  47
+        #   See ActionWebService::SignatureTypes for a canonical list of the base types.
44 48
         # * The Class object of the parameter type
45 49
         # * A single-element Array containing one of the two preceding items. This
46 50
         #   will cause Action Web Service to treat the parameter at that position
35  actionwebservice/lib/action_web_service/support/signature_types.rb
... ...
@@ -1,6 +1,19 @@
1 1
 module ActionWebService # :nodoc:
2  
-  module SignatureTypes # :nodoc:
3  
-    def canonical_signature(signature)
  2
+  # Action Web Service supports the following base types in a signature:
  3
+  #
  4
+  # [<tt>:int</tt>]      Represents an integer value, will be cast to an integer using <tt>Integer(value)</tt>
  5
+  # [<tt>:string</tt>]   Represents a string value, will be cast to an string using the <tt>to_s</tt> method on an object
  6
+  # [<tt>:base64</tt>]   Represents a Base 64 value, will contain the binary bytes of a Base 64 value sent by the caller
  7
+  # [<tt>:bool</tt>]     Represents a boolean value, whatever is passed will be cast to boolean (<tt>true</tt>, '1', 'true', 'y', 'yes' are taken to represent true; <tt>false</tt>, '0', 'false', 'n', 'no' and <tt>nil</tt> represent false)
  8
+  # [<tt>:float</tt>]    Represents a floating point value, will be cast to a float using <tt>Float(value)</tt>
  9
+  # [<tt>:time</tt>]     Represents a timestamp, will be cast to a <tt>Time</tt> object
  10
+  # [<tt>:datetime</tt>] Represents a timestamp, will be cast to a <tt>DateTime</tt> object
  11
+  # [<tt>:date</tt>]     Represents a date, will be cast to a <tt>Date</tt> object
  12
+  #
  13
+  # For structured types, you'll need to pass in the Class objects of
  14
+  # ActionWebService::Struct and ActiveRecord::Base derivatives.
  15
+  module SignatureTypes
  16
+    def canonical_signature(signature) # :nodoc:
4 17
       return nil if signature.nil?
5 18
       unless signature.is_a?(Array)
6 19
         raise(ActionWebServiceError, "Expected signature to be an Array")
@@ -9,7 +22,7 @@ def canonical_signature(signature)
9 22
       signature.map{ |spec| canonical_signature_entry(spec, i += 1) }
10 23
     end
11 24
 
12  
-    def canonical_signature_entry(spec, i)
  25
+    def canonical_signature_entry(spec, i) # :nodoc:
13 26
       orig_spec = spec
14 27
       name = "param#{i}"
15 28
       if spec.is_a?(Hash)
@@ -28,14 +41,14 @@ def canonical_signature_entry(spec, i)
28 41
       end
29 42
     end
30 43
 
31  
-    def canonical_type(type)
  44
+    def canonical_type(type) # :nodoc:
32 45
       type_name = symbol_name(type) || class_to_type_name(type)
33 46
       type = type_name || type
34 47
       return canonical_type_name(type) if type.is_a?(Symbol)
35 48
       type
36 49
     end
37 50
 
38  
-    def canonical_type_name(name)
  51
+    def canonical_type_name(name) # :nodoc:
39 52
       name = name.to_sym
40 53
       case name
41 54
         when :int, :integer, :fixnum, :bignum
@@ -59,17 +72,17 @@ def canonical_type_name(name)
59 72
       end
60 73
     end
61 74
 
62  
-    def canonical_type_class(type)
  75
+    def canonical_type_class(type) # :nodoc:
63 76
       type = canonical_type(type)
64 77
       type.is_a?(Symbol) ? type_name_to_class(type) : type
65 78
     end
66 79
 
67  
-    def symbol_name(name)
  80
+    def symbol_name(name) # :nodoc:
68 81
       return name.to_sym if name.is_a?(Symbol) || name.is_a?(String)
69 82
       nil
70 83
     end
71 84
 
72  
-    def class_to_type_name(klass)
  85
+    def class_to_type_name(klass) # :nodoc:
73 86
       klass = klass.class unless klass.is_a?(Class)
74 87
       if derived_from?(Integer, klass) || derived_from?(Fixnum, klass) || derived_from?(Bignum, klass)
75 88
         :int
@@ -92,7 +105,7 @@ def class_to_type_name(klass)
92 105
       end
93 106
     end
94 107
 
95  
-    def type_name_to_class(name)
  108
+    def type_name_to_class(name) # :nodoc:
96 109
       case canonical_type_name(name)
97 110
       when :int
98 111
         Integer
@@ -115,7 +128,7 @@ def type_name_to_class(name)
115 128
       end
116 129
     end
117 130
 
118  
-    def derived_from?(ancestor, child)
  131
+    def derived_from?(ancestor, child) # :nodoc:
119 132
       child.ancestors.include?(ancestor)
120 133
     end
121 134
 
@@ -204,6 +217,6 @@ def structured?
204 217
     end
205 218
   end
206 219
 
207  
-  class Base64 < String
  220
+  class Base64 < String # :nodoc:
208 221
   end
209 222
 end

0 notes on commit 1b07366

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