class Module

TODO: use a better approach than this monkey-patch

Public Instance Methods

component_eval(&block) click to toggle source

Like module_eval, but it also shifts the ConstantScope of the block

# File lib/myco/bootstrap/component.rb, line 194
def component_eval &block
  block_env = block.block
  cscope = Rubinius::ConstantScope.new(self, block_env.constant_scope)
  if defined? ::Myco::FileToplevel && self < ::Myco::FileToplevel
    cscope.set_myco_file
  elsif defined? ::Myco::Category && self < ::Myco::Category
    cscope.set_myco_category
  else
    cscope.set_myco_component
  end
  result = block_env.call_under(self, cscope, true, self)
  result
end