Class: Loom::Pattern::ReferenceSet::Builder

Inherits:
Object
  • Object
show all
Defined in:
lib/loom/pattern/reference_set.rb

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shell_module, source) ⇒ Builder

Returns a new instance of Builder.



71
72
73
74
75
# File 'lib/loom/pattern/reference_set.rb', line 71

def initialize(shell_module, source)
  @shell_module = shell_module
  @pattern_mod_specs = pattern_mod_specs
  @source = source
end

Class Method Details

.create(ruby_code, source) ⇒ Object



59
60
61
62
63
64
65
66
67
68
# File 'lib/loom/pattern/reference_set.rb', line 59

def create(ruby_code, source)
  shell_module = Module.new
  shell_module.include Loom::Pattern
  # TODO: I think this is my black magic for capturing stacktrace
  # info... I forget the details. Add documentation.
  shell_module.module_eval ruby_code, source, 1
  shell_module.namespace ""

  self.new(shell_module, source).build
end

Instance Method Details

#buildObject



77
78
79
80
81
# File 'lib/loom/pattern/reference_set.rb', line 77

def build
  ref_set = ReferenceSet.new
  ref_set.add_pattern_refs pattern_refs
  ref_set
end