Skip to content

Commit

Permalink
moving dsl
Browse files Browse the repository at this point in the history
  • Loading branch information
guilhermesilveira committed Oct 21, 2010
1 parent c289057 commit af39078
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 18 deletions.
20 changes: 2 additions & 18 deletions lib/restfulie.rb
Expand Up @@ -5,25 +5,9 @@
require 'restfulie/client'
require 'restfulie/server'

# Shortcut to Restfulie::Client::EntryPoint
# Shortcut to RestfulieDsl
module Restfulie

class RestfulieDsl

def initialize
@traits = []
base
end

def method_missing(sym, *args)
trait = "Restfulie::Client::Feature::#{sym.to_s.classify}".constantize
@traits << trait
self.extend trait
self
end

end

# creates a new entry point for executing requests
def self.at(uri)
Restfulie.using {
Expand All @@ -39,7 +23,7 @@ def self.using(&block)
end

def self.use(&block)
RestfulieDsl.new.instance_eval(&block)
Restfulie::Client::Dsl.new.instance_eval(&block)
end

end
Expand Down
1 change: 1 addition & 0 deletions lib/restfulie/client.rb
Expand Up @@ -11,6 +11,7 @@ module Client
autoload :Mikyung, 'restfulie/client/mikyung'
autoload :Cache, 'restfulie/client/cache'
autoload :Feature, 'restfulie/client/feature'
autoload :Dsl, 'restfulie/client/dsl'

mattr_accessor :cache_provider, :cache_store

Expand Down
17 changes: 17 additions & 0 deletions lib/restfulie/client/dsl.rb
@@ -0,0 +1,17 @@
module Restfulie::Client
class Dsl

def initialize
@traits = []
base
end

def method_missing(sym, *args)
trait = "Restfulie::Client::Feature::#{sym.to_s.classify}".constantize
@traits << trait
self.extend trait
self
end

end
end

0 comments on commit af39078

Please sign in to comment.