※上記の広告は60日以上更新のないWIKIに表示されています。更新することで広告が下部へ移動します。

<app-root>/resources/map.rb
 class Map < Waves::Resources::Base
   on( method, path ) { to(...) }


<waves-root>/resources/mixin.rb (onのところ)
   module ClassMethods
     def on( method, path = true, options = nil, &block )
       matcher = Waves::Matchers::Resource.new( options )
     def self.included( resource )
       resource.module_eval do 
         include ResponseMixin, Functor::Method ; extend ClassMethods
 class Base ; include Mixin ; end 


<waves-root>/machers/resource.rb
       @matcher = Waves::Matchers::Request.new( options )
     def call( resource ) ; @matcher.call( resource.request ) ; end


<waves-root>/machers/request.rb
   class Request < Base
     def call( request )
<waves-root>/machers/uri.rb
   class URI < Base
       @path = Waves::Matchers::Path.new( options[ :path ] )
     def call( request )
 <waves-root>/machers/path.rb
   class Path < Base
     def call( request )
<waves-root>/machers/content_type.rb
   class ContentType < Base
     def call( request ) 
<waves-root>/machers/accept.rb
   class Accept < Base
     def call( request ) 
<waves-root>/machers/query.rb
   class Query < Base
     def call( request )
<waves-root>/machers/traits.rb
   class Traits < Base
     def call( request )

再び<waves-root>/resources/mixin.rb (onの続き method/pathのところ)
   module ClassMethods
       def on( method, path = true, options = nil, &block )
         methods = case method
         methods.each do | method |
           functor_with_self( method, matcher, &block )

3度<waves-root>/resources/mixin.rb (toのところ body返す)
   module ClassMethods
     def self.included( resource )
       resource.module_eval do 
         def to( resource )
             Waves.main::Resources[ resource ]
           r = traits.waves.resource = resource.new( request )
           r.process
         def process
             before ; body = send( request.method ) ; after
           return body