lib/jumoku/builders/shared.rb in jumoku-0.2.4 vs lib/jumoku/builders/shared.rb in jumoku-0.2.5

- old
+ new

@@ -1,16 +1,15 @@ module Jumoku # This module provides the basic routines needed to implement the specialized - # builders: {UndirectedTreeBuilder} and {DirectedTreeBuilder}. + # builders: {RawUndirectedTreeBuilder} and {RawDirectedTreeBuilder}. # module Shared - STRATEGIES = [:edge_labeling, :node_labeling] - def self.included(base) base.class_eval do # Late aliasing as it references methods provided by Plexus modules. alias has_node? has_vertex? + include Jumoku::Strategies end end attr_accessor :_options @@ -209,18 +208,12 @@ # def _clone self.class.new(self) end - def _extract_strategies(options) - options = options.dup.select! { |k,v| STRATEGIES.include?(k) } || options.dup - options.inject([]) do |strategies, (k,v)| - begin - strategies << Jumoku.const_get(k.to_s.constantize).const_get(v.to_s.constantize) - strategies - rescue NameError # silently ignored - strategies - end - end + # Some code chunks must be module evaled at runtime. + # + def _delay + class << self; self; end.module_eval { yield } end end end