Top Level Namespace

Defined Under Namespace

Modules: Recursive, Ron Classes: Array, Bignum, Binding, Class, Float, Hash, Module, Object, Range, Regexp, Set, String, Struct

Constant Summary collapse

SR =
Ron::DefaultMarker
SelfReferencing =

old name alias

Recursive
SelfReferential =

old name alias

SelfReferencing

Instance Method Summary collapse

Instance Method Details

#Recursive(*args) ⇒ Object

marker=‘foo’,data



120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
# File 'lib/ron.rb', line 120

def Recursive *args #marker='foo',data
    marker,data=*case args.size
    when 2; args
    when 1; [::Ron::DefaultMarker,args.last]
    else raise ArgumentError
    end

    ::Ron::GraphWalk.graphwalk(data){|cntr,o,i,ty|
      if o.equal? marker 
        ty.new(cntr,i,1){data}.replace
        data.extend Recursive
      end
    }  
    data
end

#SelfReferencingObject Also known as: SelfReferential

old name alias



135
136
137
# File 'lib/ron.rb', line 135

def SelfReferencing #old name alias
  Recursive(v=Object.new, yield(v))
end