lib/rio/state.rb in rio-0.3.1 vs lib/rio/state.rb in rio-0.3.2
- old
+ new
@@ -38,10 +38,11 @@
require 'rio/exception/state'
require 'rio/context'
require 'rio/context/methods'
require 'rio/ext'
require 'rio/symantics'
+$trace_states = false
module RIO
module State #:nodoc: all
# = State
@@ -107,11 +108,11 @@
# the method for changing states
# it's job is create an instance of the next state
# and change the value in the handle that is shared with the fs object
def become(new_class,*args)
- #p "become : #{self.class.to_s} => #{new_class.to_s} (#{self.mode?})" if $trace_states
+ p "become : #{self.class.to_s} => #{new_class.to_s} (#{self.mode?})" if $trace_states
#
return self if new_class == self.class
begin
try_state[new_class,*args]
@@ -122,11 +123,11 @@
end
def method_missing_trace_str(sym,*args)
"missing: "+self.class.to_s+'['+self.to_url+']'+'.'+sym.to_s+'('+args.join(',')+')'
end
def method_missing(sym,*args,&block)
- #p method_missing_trace_str(sym,*args) if $trace_states
+ p method_missing_trace_str(sym,*args) if $trace_states
obj = when_missing(sym,*args)
raise RuntimeError,"when_missing returns nil" if obj.nil?
obj.__send__(sym,*args,&block) #unless obj == self
end
@@ -161,18 +162,28 @@
Error.error(emsg,self,sym,*args)
end
def to_rl() self.rl.rl end
- def fspath() @rl.fspath end
- def path() @rl.path() end
- def to_s() @rl.to_s() end
+
+ extend Forwardable
+# def_instance_delegators(:rl,:path,:to_s,:fspath,:opaque,:host,:length)
+ def_instance_delegators(:rl,:path,:to_s,:fspath,:length)
+
+# def fspath() @rl.fspath end
+# def path() @rl.path() end
+# def opaque() @rl.opaque() end
+# def scheme() @rl.scheme() end
+# def host() @rl.host() end
+# def to_s() @rl.to_s() end
+# def length() @rl.length end
+
+
def ==(other) @rl == other end
def ===(other) self == other end
def =~(other) other =~ self.to_s end
def to_url() @rl.url end
def to_uri() @rl.uri end
- def length() @rl.length end
alias to_str to_s
def hash() @rl.to_s.hash end
def eql?(other) @rl.to_s.eql?(other.to_s) end