Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Domaintree
- include Enumerable
- def initialize
- @doms = ["."]
- @leafs = []
- end
- def add(leaf)
- @leafs << leaf
- end
- def get(leaf)
- end
- def get
- @leafs
- end
- def end?
- true
- end
- def to_s
- puts @doms
- end
- end
- class Domain
- include Enumerable
- @domain
- @subdomains = []
- def initialize(par)
- puts par.class
- puts @paren.class
- setparent(par)
- setdom(dom)
- end
- def setparent(parent)
- @parent = parent
- end
- def setdom(dom)
- @domain = dom
- end
- def getparent
- @parent
- end
- def getdom
- @domain
- end
- def addsub(dom)
- @subdomains <<self.new(dom,@parent)
- end
- def getsub(dom)
- @subdomains
- end
- def delsub(dom)
- end
- end
- irb(main):1790:0* test1 = Domaintree.new
- .
- =>
- irb(main):1791:0> est2 = Domain.new(test1)
- Domaintree
- NilClass
- NameError: .
- undefined local variable or method `dom' for #<Domain:0x000000009bb630>
- from (irb):1756:in `initialize'
- from (irb):1791:in `new'
- from (irb):1791
- from /usr/bin/irb:12:in `<main>'
- irb(main):1792:0>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement