Sha256: 256d89188f0dd33902556bb9eae1ee557c61ab9dc5fa4d92a60c829a8bfd2ead
Contents?: true
Size: 669 Bytes
Versions: 3
Compression:
Stored size: 669 Bytes
Contents
class Link attr_accessor :source, :target def initialize(arg) @args = arg @source = @args.delete(:source) @target = @args.delete(:target) raise Exception.new("source cant be nil") unless @source raise Exception.new("target cant be nil") unless @target raise Exception.new("source must be of type Node") unless @source.is_a? Node raise Exception.new("target must be of type Node") unless @target.is_a? Node @args[:weight] ||= 1 @source.neighbours << @target @target.neighbours << @source end def method_missing(name, *args) super unless args.empty? @args[name] end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rgraph-0.0.6 | lib/rgraph/link.rb |
rgraph-0.0.5 | lib/rgraph/link.rb |
rgraph-0.0.4 | lib/rgraph/link.rb |