lib/mirage/client/client.rb in mirage-3.0.0.alpha.9 vs lib/mirage/client/client.rb in mirage-3.0.0.alpha.10
- old
+ new
@@ -7,20 +7,22 @@
class Client
include HTTParty
attr_reader :url
- def initialize options={:url => "http://localhost:7001/mirage"}
+ def initialize options={:url => "http://localhost:7001/mirage"}, &block
if options.is_a?(String) && options =~ URI.regexp
warn("Client.new(url): Deprecated usage, please use :url => url | :port => port")
@url = options
elsif options.kind_of?(Hash) && options[:port]
@url = "http://localhost:#{options[:port]}/mirage"
elsif options.kind_of?(Hash) && options[:url]
@url = options[:url]
else
raise "specify a valid URL or port"
end
+
+ templates.default_config &block if block
end
def templates id=nil
return Template.get("#{@url}/templates/#{id}") if id
Templates.new(@url)
\ No newline at end of file